Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jeff
 
Posts: n/a
Default Saving Info to Matrix

Hi,

I have 5 tables of values. The 5 tables are 91x100 (Rows x Columns). The
tables are in excel. I want to write a macro - that uses the table. It
would be more convenient to put the 5 tables in a 5 x 91 x 100 matrix and
save as a variable - and get rid of the 5 tabs - to reduce the clutter.

How is this done in VBA?

Thanks
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

I would use 5 different worksheets (and hide the worksheets if that's
important). I think it would make updating the table easier (in general).

But using 5 names each an array 91 by 100 worked ok for me. But I think that
you'll need xl2002+ for this. xl2k (and earlier had a limit of 5461 elements,
IIRC).

Option Explicit
Sub LoadVariablesIntoNames()

Dim myArray As Variant
Dim wCtr As Long
Dim wks As Worksheet

For wCtr = 1 To 5
Set wks = Worksheets("sheet" & wCtr)
myArray = wks.Range("a1").Resize(91, 100).Value
Names.Add Name:="Table" & wCtr, RefersTo:=myArray
Next wCtr

End Sub

Sub RetrieveValuesFromName()
Dim myArray(1 To 5) As Variant
Dim wCtr As Long

For wCtr = 1 To 5
myArray(wCtr) = Evaluate("table" & wCtr)
Next wCtr

'what was in sheet3, row 4, column 7?
MsgBox myArray(3)(4, 7)

End Sub

Jeff wrote:

Hi,

I have 5 tables of values. The 5 tables are 91x100 (Rows x Columns). The
tables are in excel. I want to write a macro - that uses the table. It
would be more convenient to put the 5 tables in a 5 x 91 x 100 matrix and
save as a variable - and get rid of the 5 tabs - to reduce the clutter.

How is this done in VBA?

Thanks


--

Dave Peterson
  #3   Report Post  
Alan Beban
 
Posts: n/a
Default

Dave Peterson wrote:
I would use 5 different worksheets (and hide the worksheets if that's
important). I think it would make updating the table easier (in general).

But using 5 names each an array 91 by 100 worked ok for me. But I think that
you'll need xl2002+ for this. xl2k (and earlier had a limit of 5461 elements,
IIRC).


That limit didn't apply to simply transferring arrays to worksheets or
vice versa.

Alan Beban
  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

Thanks for the memory jog.

But it did effect =index(), IIRC?????



Alan Beban wrote:

Dave Peterson wrote:
I would use 5 different worksheets (and hide the worksheets if that's
important). I think it would make updating the table easier (in general).

But using 5 names each an array 91 by 100 worked ok for me. But I think that
you'll need xl2002+ for this. xl2k (and earlier had a limit of 5461 elements,
IIRC).


That limit didn't apply to simply transferring arrays to worksheets or
vice versa.

Alan Beban


--

Dave Peterson
  #5   Report Post  
Alan Beban
 
Posts: n/a
Default

Dave Peterson wrote:
Thanks for the memory jog.

But it did effect =index(), IIRC?????


Yes

Alan Beban
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
Get info from Matrix PÃ¥l Excel Worksheet Functions 1 May 3rd 05 12:59 PM
CORRELATION / COVARIANCE MATRIX Walker Excel Worksheet Functions 1 April 30th 05 06:36 AM
Track info from one w/sheet onto another. Ilga Excel Worksheet Functions 0 April 29th 05 03:44 PM
Opening and saving Excel 2003 file from Excel 97. Rodrigo Excel Discussion (Misc queries) 2 December 12th 04 02:17 PM
paste info into merged cells Marc Setting up and Configuration of Excel 0 December 6th 04 09:09 PM


All times are GMT +1. The time now is 10:10 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"