VBA combining Select & Name = statements

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,124
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm working with:


Code:
    Sheets("First SEP REPORT").Select
    Sheets("First SEP REPORT").Name = "Second SEP REPORT"

Where I'm trying to select the worksheet then change its name. I have 24 tabs where this code is providing a sample of the macro I'm using above.



Does anyone know how to combine these particular VBA statements?


I've tried experimenting on this method:

Code:
Application.Goto Worksheets("First SEP REPORT").Name = "Second SEP REPORT", True

But this is not working well for me, when I am combining these steps in this way.

Any ideas??

Thanks,
Pinaceous
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You don't need to select a sheet to change it's name so this on its own should do.
Code:
    Sheets("First SEP REPORT").Name = "Second SEP REPORT"
 
Upvote 0
I'm actually getting a

VBA Run-time error '1004':

Application-defined or object-defined error

I cannot seem to make this work w/o first individually selecting the specific sheet.

Any suggestions?
 
Upvote 0
Wait, wait, wait, it works, my apologizes! I had to unlock the workbook!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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