且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将单元格值拆分为数字数组

更新时间:2023-02-04 19:58:44

这对我来说非常有效,并且设置起来非常简单!我将以单元格A1为例,并使用数字字符串.

This worked great for me and was very easy to set up! I will use cell A1 as the example with the string of numbers.

Dim strarray as Variant
Dim intarray as Variant
Dim x as Long

strarray = Split(Range("A1").Value, "_")
ReDim intarray(LBound(strarray) to UBound(strarray))
For x = LBound(strarray) To UBound(strarray)
    intarray(x) = CInt(strarray(x))
Next x