ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Rename worksheet in macro (https://www.excelbanter.com/excel-worksheet-functions/159460-rename-worksheet-macro.html)

JBW

Rename worksheet in macro
 
I download a file every day, I have a great macro that does a load of stuff
but have realised one shortcoming.

Every day the original worksheets name tab (business system generated)
includes the date, so it changes its name every day.

When I ask my macro to select the tab and change the name as part of the
required tasks, it will stop dead when tomorrow comes and the name has
changed due to the new date.

I'm an obsolute novice VB editor, but would be grateful if anyone can see a
way around this other than getting IT to remove the date field from the tab
name .



Mike

Rename worksheet in macro
 
You should try and reference the worksheet name tab as ActiveSheet.Name

ActiveSheet.Name = Format(Date, "mmddyy")

"JBW" wrote:

I download a file every day, I have a great macro that does a load of stuff
but have realised one shortcoming.

Every day the original worksheets name tab (business system generated)
includes the date, so it changes its name every day.

When I ask my macro to select the tab and change the name as part of the
required tasks, it will stop dead when tomorrow comes and the name has
changed due to the new date.

I'm an obsolute novice VB editor, but would be grateful if anyone can see a
way around this other than getting IT to remove the date field from the tab
name .




All times are GMT +1. The time now is 10:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com