route217
asked on
VBA Code to change worksheet tab name.
Hi Experts.
The tab name end part is different each month as it relates to the day and month the download was done.
So In Sept 20
Tab worksheet tab name would be Imap Product 20-09 in Oct this would Imap Product 20-10.
I want to dynamically change this tab name to IMAP Products each month (ignore date element) in total I have 30 tab names to change..
The tab name end part is different each month as it relates to the day and month the download was done.
So In Sept 20
Tab worksheet tab name would be Imap Product 20-09 in Oct this would Imap Product 20-10.
I want to dynamically change this tab name to IMAP Products each month (ignore date element) in total I have 30 tab names to change..
ASKER
Hang fire ill.post and excel workbook..might be a while
These two lines will change the tab name to the format you want:
Paul
tName = "Imap Product " & Format(DateValue(Now), "yy-mm")
ActiveSheet.Name = tName
It uses the Now function so if you run it in November it will name the tab "Imap Product 20-11". If you need it to change to reflect the value of a certain cell, such as A1, then change DateValue(Now) to DateValue(Range("A1").Value Paul
@Flyster
he says "I have 30 tab names to change..."
so, it is not clear how to change all, they should be unique names...
he says "I have 30 tab names to change..."
so, it is not clear how to change all, they should be unique names...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@Flyster
and use it to rename all tabs to "Imap Product YY-MM"
I doubt so...
waiting for excel he will post...
This code will loop through your workbook and change all the tab namesso you assume, we have dates stored somewhere...
and use it to rename all tabs to "Imap Product YY-MM"
I doubt so...
waiting for excel he will post...
ASKER
The day and month are needed.
From where are those data pulled from ?
From where are those data pulled from ?
ASKER
Hi Experts
I am going to provide a full mapping shortly from too.. day and month are not required. That part has to be removed
I am going to provide a full mapping shortly from too.. day and month are not required. That part has to be removed
So, each worksheet should be named "IMAP Products" ?
Not doable, Excel do not allow duplicate names for worksheets.
Not doable, Excel do not allow duplicate names for worksheets.
you cannot give same names to sheets...