Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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




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
3 dimensional array gti_jobert[_7_] Excel Programming 2 February 2nd 06 03:00 PM
Mutli-dimensional Array to Single-Dimension Array Blue Aardvark Excel Programming 3 October 15th 05 09:22 AM
Create One-Dimensional Array from Two-Dimensional Array Stratuser Excel Programming 1 February 23rd 05 08:46 PM
add to two dimensional array GUS Excel Programming 1 August 26th 03 12:12 AM
2 Dimensional Array steve Excel Programming 0 August 18th 03 07:19 PM


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

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

About Us

"It's about Microsoft Excel"