referencing a changing sheet name

xtraxmechx

New Member
Joined
Jul 18, 2011
Messages
2
Hello All,

I have a work book that has multiple types of parts. I then run a macro that pull all the different sheets together in to one sheet tiltled "master price list, mmm-dd-yyyy". Im trying to make sure that everything has copied correctly. My rational is to simply use the count function on all the old sheets VS. the new sheet. I run in to a problem when I try and reference the new sheet as the date is always changing.

Any and all help is appreciated.

j
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Not sure from your post but if the sheet in question is not moving in its place relative to the other sheets before it you can just use the sheet index number instead of the name.

For example (Assuming "Sheet1" is the default label for the first sheet in workbook):
Code:
Sheets("Sheet1").Range("A1").Value

Is the same as:

Code:
Sheets(1).Range("A1").Value
 
Upvote 0
If you always launch the macro from the merged sheet, you can use something like below to store the sheet name in a macro.

ActiveSheet.Name

Or if you want to launch it from anywhere, but the sheet is always in a certain order in your workbook, you coudl reference it by it's index location.

Worksheets(1).Name

Hope those suggestions help.
 
Upvote 0
Sorry I want clear enough. I'm looking to type this in to the formula bar not in a macro.

I.e. something like this.

=count(worksheet(1)K5:Q13000)

This would then return the number of cells with numbers in the array in the first worksheet.

Right now I have

=count('Master Price List JUL-18-2011'!K5:13000)

While this works now, if I were to run the macro tommorow the price list's date would change thus making a error as this sheet would no longer exist.
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

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