EXCEL VBA 数组赋值问题

2025-04-06 02:39:28
推荐回答(1个)
回答1:

呵呵,需要加一个转置函数 Application.Transpose(ActiveSheet.Range("a1:a10").Value )

sub abc()
Dim abcd() As Variant
abcd = Application.Transpose(ActiveSheet.Range("a1:a10").Value)
MsgBox UBound(abcd)

For i = 1 To UBound(abcd)
MsgBox (abcd(i))
Next
end sub