Save "Range-Value" to variable?
dim MyData as Variant
MyData = Range("A1:C10")
now you have an array (MyData) through which you can
loop..
Sub Test()
Dim MyData As Variant
Dim rw As Long
Dim cl As Long
MyData = Range("A1:C10")
For rw = LBound(MyData, 1) To UBound(MyData, 1)
For cl = LBound(MyData, 2) To UBound(MyData, 2)
' do something with MyData(rw,cl)
MsgBox MyData(rw, cl)
Next cl
Next rw
End Sub
Patrick Molloy
Microsoft Excel MVP
-----Original Message-----
Hi,
I need to extract the Range of an excel sheet into a
variable.
I want to get the "A1:C10" value as a string or as a
list, if there
are multiple selections. I have looked into the VBA
manual of
WinXP-Excel but I can't found this topic.
VarRange = Worksheet("Sheet1").Range won't work.
If somebody knows an answer, please give me a reply.
sincerely
A. Winter
.
|