Question

Kind of a strange request. I have 20 sheets worksheets called Worksheet1, Worksheet2,Worksheet3...Worksheet20.

On SheetA in cell A2, I have a drop down menu where users can select "Worksheet1", "Worksheet2"..."Worksheet20"

When the user changes that cell A2, I want all the cells on SheetA to change their reference from Worksheet1 to Worksheet2. So instead of cell B2 having the formula: Worksheet1!C2 , I want that cell to have the formula: Worksheet2!C2. So Worksheet1!C2 has the value of "Texas". Worksheet2!C2 has the value "Wyoming".

So if I change SheetA("A2)", then I want the value to change from "Texas" to "Wyoming". Can you help me make formulas dynamic? Thanks!

Was it helpful?

Solution

If the dropdown menu is a Form Control/ComboBox then its linked cell will contain a value 1,2, etc. In another cell you would use INDEX() to translate the selected value to the text Worksheet1, Worksheet2, etc..

All your formulas would then be:

=INDIRECT(C1&"!A1")

where C1 contains the text Worksheet1 (or Worksheet2, etc.) and A1 is the particular cell's value that you want to retrieve from this sheet.

Note that "A1" is now a string so inserting a row or column into one of these sheets won't cause it to change as it would do normally.

Added: To enable the cell reference to change if rows/cols are inserted in the linked worksheet(s) you would use this version:

=INDIRECT("'"&C1&"'!"&CELL("address",A1))

(courtesy of a colleague, Hans.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top