View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Set a Range to a variable

'Declare your variables
Dim sec1, sec2, sec3

Set sec1 = Range("B3:E3")
Set sec2 = Range("G3:J3")
Set sec3 = Range("L3:O3")
'This creates 3 1Row,4Col 2D arrays


'Do something with them
Dim v1, v2, v3, n&

For n = LBound(sec1, 2) To UBound(sec1, 2)
MsgBox sec1(1, n)
Next

For n = LBound(sec2, 2) To UBound(sec2, 2)
MsgBox sec2(1, n)
Next

For n = LBound(sec3, 2) To UBound(sec3, 2)
MsgBox sec3(1, n)
Next

HTH

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion