PDA

Click to See Complete Forum and Search --> : Excel: name arrays


krtxmrtz
Jun 27th, 2006, 10:11 AM
Is it possible to have arrays of names for different ranges in Excel? The idea is I have 2 tables of the same size in different sheets and I would like to call them, say table(1) and table(2) so that calculations are performed with either table according to the selected value from a combobox.

DKenny
Jun 27th, 2006, 10:24 AM
you could add a new name tot he worksheet that refers to either table(1) or table(2), dependant on the checkbox value.

This is not easy to explain, so I've included an example.
There are 2 base named ranges, TABLE1 and TABLE2.
The checkbox is linked to another named range called TOGGLE_TABLE.
Then I added a new name, called SELECTED_TABLE, with the following formula =IF(TOGGLE_TABLE,TABLE2,TABLE1)

This formula driven name will change its reference based on the checkbox value.

krtxmrtz
Jun 27th, 2006, 10:58 AM
Yes, that's what I need but I thought maybe I could use the same name for all my tables. If some time in the future I need to add supplementary tables to the spreadsheet then arrays make it easier to implement. Or maybe, on second thoughts, your method is just as easy... Thanks!

For now I won't mark the thread resolved yet, just in case someone may come up with an unexpected trick.

DKenny
Jun 27th, 2006, 11:14 AM
You could dynamically change the value of the RefersToRange Property of the Name object.

krtxmrtz
Jun 27th, 2006, 11:40 AM
You could dynamically change the value of the RefersToRange Property of the Name object.
I'll take a look at this property...never used it before.

krtxmrtz
Jun 27th, 2006, 03:43 PM
Seems a promising possibility :thumb: