How to return Array() to range as variable?
"Mike H" wrote:
try it like this
[....]
Dim rng
Set rng = Range("b2:d2")
rng.Value = Array(21, 22, 23)
Please discuss the semantic differences between that solution and mine,
namely:
Dim rng as Range
set rng = Range("b2:d2")
rng = Array(21,22,23)
Are these simply two equivalent ways to do the same thing? Or is mine
fundamentally different (how)?
I'm not clear on when to use a variant v. Range, and when I need the Value
qualifier.
----- original message -----
"Mike H" wrote in message
...
Hi,
try it like this
Sub testit()
Dim rng
Set rng = Range("b2:d2")
rng.Value = Array(21, 22, 23)
End Sub
Mike
"JoeU2004" wrote:
The following does what I want:
Sub testit()
Range("b2:d2") = Array(21, 22, 23)
End Sub
But I would prefer to use a variable instead of Range("b2:d2"). (Part of
a
larger macro.)
Why doesn't the following work? More importantly, how can I make it
work?
Sub testit()
Dim rng
Set rng = Range("b2:d2")
rng = Array(21, 22, 23)
End Sub
|