View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_4_] Alan Beban[_4_] is offline
external usenet poster
 
Posts: 171
Default Transferring ranges to/from arrays

Jag Man wrote:
Alan,

Oops! Yes, you are right. As a matter of fact, I demonstrated that in
my example. But, can you contradict my conclusion that you can't do the
reverse?


Nope (although the code below doesn't attempt to assign a range to the
array inArgs; inVars does not refer to a range, but is a Variant()
variable/array)

Alan Beban

E.g.,

inVars = Range("x").Resize(2, 1).Value
Dim inArgs(2) As Double

inArgs = inVars ' Won't work. Cannot assign to array

Thanks for your interest.


Ed



Jag Man wrote:
. . .The

upshot is that (a) Only Variants can
be used to move data to/from ranges . . . .


From yes, to no. The following works:

Sub testIt()
Dim arr(3) As Long
arr(1) = 1
arr(2) = 2
arr(3) = 3
Range("A1:C1").Value = arr
End Sub

Alan Beban


"Alan Beban" wrote in message
...

Jag Man wrote:
. . .The

upshot is that (a) Only Variants can
be used to move data to/from ranges . . . .


From yes, to no. The following works:

Sub testIt()
Dim arr(3) As Long
arr(1) = 1
arr(2) = 2
arr(3) = 3
Range("A1:C1").Value = arr
End Sub

Alan Beban