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

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

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
 

Forum statistics

Threads
1,148,053
Messages
5,744,531
Members
423,881
Latest member
Nguyen Vu

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