VBA combining Select & Name = statements

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,113
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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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,216,075
Messages
6,128,660
Members
449,462
Latest member
Chislobog

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