Indirect sheet reference 2nd sheet regardless of name

muhleebbin

Active Member
Joined
Sep 30, 2017
Messages
252
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2010
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
In VBA there's the sheet reference method Sheets(2) to reference the second sheet from left to right. Is there a way to work a similar reference in a formula? I'd like cells on the first sheet to be able to reference cells on the second - eighth sheets regardless of the names that are on the sheets or the sheet numbers. The formula is needed because users will add and delete sheets on a whim so this would make this user proof.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Short answer, No.

There is no way to refer "next sheet" by only using formulas afaik.
 
Upvote 0
Yeah I couldn't find anything.

I did think of a work around by using this page's idea:


I put this on the 10th sheet (1 being the report and 2-9 being the 8 sheets needing to reference from). Used rows 1-25 even though I only needed 10 rows (overkill and future proofing it).

Put the following code in a module

VBA Code:
Sub recalculate()
  
    Worksheets("Lists").Range("B2:B25").Formula = "=INDEX(SheetNames,RC[-1])"

End Sub

And called the sub in a worksheet activate for sheet1. If anyone renamed/deleted or added a worksheet then it would update the list on the 10th sheet.

Indirect then worked by referencing the cells in B2:B25.

Only flaw I can think of is if someone adds a sheet before sheet1 or moves a sheet left of it. But hopefully no one's that dumb to do that. o_O
 
Last edited:
Upvote 0
Solution
Just curious how it would be done via VBA? The VBA was necessary to account for sheet name changes since the formula on the 10th sheet was static.

Ultimately I was trying to get a formula like this to work on sheet1:

=INDIRECT("'" & Lists!B2 &"'!" & "C7")

Where Lists!B2 in this case will always be Sheets(2) regardless of name/sheet number.
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top