View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Bill Martin[_2_] Bill Martin[_2_] is offline
external usenet poster
 
Posts: 105
Default Populating Two Dimensional Array

Thanks Tom.

Bill
---------------
"Tom Ogilvy" wrote in message
...
Selecting in rarely required and when not, not recommended. It isn't
required in this case.

dim v as Variant
dim LastRow as Long
LastRow = range("A1").end(xldown).row
v = range("A1:B" & LastRow).Value


--
Regards,
Tom Ogilvy


"Bill Martin" wrote:

Try doing what was suggested, but first use VBA to do the selection
automagically:

dim LastRow as Long
LastRow = range("A1").end(xldown).row
range("A1:B" & LastRow).select

Bill
------------------------
"willz99ta via OfficeKB.com" <u6624@uwe wrote in message
news:5d40a230adbea@uwe...
I can't use the selection function since this is part of a larger
program.
What is the easiest way to loop it?

Thanks again,
Will


Martin wrote:
You could loop but the quickest method is to use a variant variable:

Dim myArray As Variant
Set myArray = Selection

Then, for example (if you've used columns A and B), myArray(1,1) will
be
A1's value, myArray(1,2) B1's, myArray(2,1) A2's, etc.

Howdy,

[quoted text clipped - 4 lines]
Thanks,
Will

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1