Excel Noob with question on referencing worksheet names

sloojer

New Member
Joined
Jan 27, 2005
Messages
5
Hello

I am trying to dynamically size a table in my "Summary" sheet with the number of "WPO" sheets in my workbook.

The WPO sheets have names of the form "WPO 1".... "WPO 100"..etc. For each WPO sheet I would like to insert a row in my summary sheet containing formulae that reference the different WPO sheets.

Here's a snippet of what I have at the moment

ActiveCell.FormulaR1C1 = = "='WPO 2'!R64C3" 'Column E

What I would like to have is a variable in the place of 'WPO 2' that I could set to any worksheet. :unsure:
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

sloojer

New Member
Joined
Jan 27, 2005
Messages
5
Sorry colour flags messed that line up..

ActiveCell.FormulaR1C1 = "='WPO 2'!R64C3"
 

cherria

Well-known Member
Joined
Nov 17, 2004
Messages
708
you would wrap your code in a FOR loop

if you know th enumber then

FOR a=1 to 100
ActiveCell.FormulaR1C1 = = "='WPO " & a & "' !R64C3" 'Column E
NEXT

If you do not know th enumber of sheets then

FOR EACH a in activeworkbook.worksheets
ActiveCell.FormulaR1C1 = = "='" & a.Name & "' !R64C3" 'Column E
NEXT
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,608
Messages
5,765,400
Members
425,282
Latest member
Nibblesy

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
Top