VBA Range与数组互相赋值

Sub test()
'Range赋值给数组(利用Application.WorksheetFunction.Transpose)
' Dim myData
'    myData = Application.WorksheetFunction.Transpose(Range("a1:e5"))
'    MsgBox "共有" & UBound(myData) & "个数据!"


Dim objrge As Range


Set objrge = Sheets(1).Range("a11:e15")
objrge.Value = myData


'Range赋值给数组
myarr = Range("a1:e5")
'数组赋值给Range
Set objrge = Sheets(1).Range("a11:e15")
objrge.Value = myarr
End Sub

你可能感兴趣的:(VBA)