Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Array question

Greetings all. I have read many posts about using arrays in a macro, but I
can't seem to find one elementary enough to suit my needs. I have never used
them, so I need basic stuff. Lets say I have three columns, "Col1", "Col2",
and "Col3", and in those columns I have 1, 2, 3, on row 2, and I have 4, 5, 6
on row three, and so forth, basically just a table of numbers. Is it
possible to use an array to temporarily store the table, then write it to
another sheet? Is there a good place to go for learning how to use them?
Thank you.

Greg
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Array question

Hi Greg,

This answer also on your other post.

Hi Greg,

In the following example it assigns the range values to an array then uses
msgbox to read the values from the 2 dimensional array.

Ensure you use ".Value" on the end of the range when assigning it or it does
not work.

Sub RangeToArray()

Dim arrMyArray()
Dim i As Long
Dim j As Long

With Sheets("Sheet1")
arrMyArray = .Range("A1:C10").Value
End With

'Number elements down (first dimension)
For i = 1 To UBound(arrMyArray)

'Number elements across (second dimension)
For j = 1 To UBound(arrMyArray, 2)
MsgBox arrMyArray(i, j)
Next j

Next i

End Sub

Also Google (or you favourite search engine) "excel vba array tutorial" for
more information

--
Regards,

OssieMac


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
array question Mona Excel Discussion (Misc queries) 2 March 23rd 10 08:41 PM
Array question AD108 Excel Programming 2 September 6th 06 05:11 PM
Array question mickiedevries[_9_] Excel Programming 3 August 24th 04 06:58 PM
Array Question hotherps[_88_] Excel Programming 2 July 30th 04 11:26 AM
array question john petty Excel Programming 1 August 29th 03 04:57 PM


All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"