View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default [excel 97 vba ] Reading ranges into an array

Sub doArrays()
Dim varr As Variant
Dim numrows As Long
Dim numcols As Long
numrows = 3
numcols = 2
varr = Worksheets("Sheet1").Range("B9"). _
Resize(numrows, numcols).Value
For i = LBound(varr, 1) To UBound(varr, 1)
For j = LBound(varr, 2) To UBound(varr, 2)
MsgBox "varr(" & i & ", " & j & ")= " & varr(i, j)
Next
Next
Worksheets("Sheet3").Range("Z11"). _
Resize(numrows, numcols).Value = varr
End Sub


--
Regards,
Tom Ogilvy

"steve" wrote in message
...
Hello

Does anyone know if there is an elegant way to do the
following

read in a range from excel
copy values into an array
...
copy array to an output range

If some knows a good tutorial on arrays and range
manipulation that would be excellent.

So far I have to do a lot of looping and can't cannot help
feeling that I have reinvented the wheel so to speak.
Perhaps this is the only option in Excel 97..

thanks

Steve