LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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


 
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 09:36 AM.

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"