Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating Two Dimensional Array
Howdy,
I'm trying to find the right syntax to fill a two dimensional with the first two columns in my excel spreadsheet. The two columns could have as few as 1 or as many as 60,000 records in them. Thanks, Will -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200603/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating Two Dimensional Array
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. "willz99ta via OfficeKB.com" wrote: Howdy, I'm trying to find the right syntax to fill a two dimensional with the first two columns in my excel spreadsheet. The two columns could have as few as 1 or as many as 60,000 records in them. Thanks, Will -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200603/1 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating Two Dimensional Array
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating Two Dimensional Array
Dim v as Variant
lastrow = cells(rows.count,1).End(xlup).Row v = Range("A1:B" & lastRow).Value ' look at the results: msgbox lbound(v,1) & ", " & ubound(v,1) & _ vbNewLine & lbound(v,2) & ", " & ubound(v,2) -- Regards, Tom Ogilvy "willz99ta via OfficeKB.com" wrote: Howdy, I'm trying to find the right syntax to fill a two dimensional with the first two columns in my excel spreadsheet. The two columns could have as few as 1 or as many as 60,000 records in them. Thanks, Will -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200603/1 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating Two Dimensional Array
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populating Two Dimensional Array
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
3 dimensional array | Excel Programming | |||
Mutli-dimensional Array to Single-Dimension Array | Excel Programming | |||
Create One-Dimensional Array from Two-Dimensional Array | Excel Programming | |||
add to two dimensional array | Excel Programming | |||
2 Dimensional Array | Excel Programming |