|
本帖最后由 eh30040922 于 2024-3-13 18:47 编辑
Option Base 1
Option Explicit
Dim i As Integer, x As Integer, y As Integer
Dim ary As Variant
Dim aryc As Variant
Dim aryi As Variant
Const nmc1 As String = "1。2。3。4"
Const nmc2 As String = "21。22。23"
Const nmc3 As String = "31。32。33"
Const nmc4 As String = "41。42"
Sub 数组边界()
aryc = Array(nmc1, nmc2, nmc3, nmc4)
For i = 1 To UBound(aryc)
aryi = Split(aryc(i), "。")
x = UBound(aryi)
y = LBound(aryi)
Range("H" & i) = i
Range("I" & i) = x
Range("J" & i) = y
Range(Cells(1, i), Cells(x, i)) = Application.WorksheetFunction.Transpose(aryi)
Next i
End Sub
请教一个数组边界的问题
Option Base 1
加这句代码后,数组的索引号初值设置为1
但是再循环里面,aryi的初始索引号还是为0,请问是我写的代码问题,还是别的什么问题?
解答见2楼,谢谢前辈的全面耐心解答
|
|