ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   I want to rename my worksheet tabs... (https://www.excelbanter.com/excel-discussion-misc-queries/236677-i-want-rename-my-worksheet-tabs.html)

Dr. Darrell

I want to rename my worksheet tabs...
 
I want to rename my worksheet tabs to be numbered: Jan-09, Feb-09,
Mar-09...Nov-10, Dec-10

I would like to start the numbering at the second Tab (The first Tab is
"Summary".

Can I place a line of code to perform this?

I am modifying 20 workbooks, so after re-typing the tabs on a couple it
seems there might be an easier way.

Jacob Skaria

I want to rename my worksheet tabs...
 
Darrell

Try the below macro

Sub CreateMonthSheets()
Dim intTemp
Dim dtTemp As Date
dtTemp = "1/Jan/2009"
ActiveWorkbook.Sheets.Add Count:=(25 - ActiveWorkbook.Sheets.Count)
For intTemp = 2 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Sheets(intTemp).Name = _
Format(DateAdd("m", (intTemp - 2), dtTemp), "mmm-yy")
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Dr. Darrell" wrote:

I want to rename my worksheet tabs to be numbered: Jan-09, Feb-09,
Mar-09...Nov-10, Dec-10

I would like to start the numbering at the second Tab (The first Tab is
"Summary".

Can I place a line of code to perform this?

I am modifying 20 workbooks, so after re-typing the tabs on a couple it
seems there might be an easier way.


Jacob Skaria

I want to rename my worksheet tabs...
 
Forgot to mention that the macro will insert 24 sheets and name from Jan-09
to Dec-10.

If you are new to macros set the Security level to low/medium in
(Tools|Macro|Security). From workbook launch VBE using short-key Alt+F11.
From menu 'Insert' a module and paste the below code. Save. Get back to
Workbook. Run macro from Tools|Macro|Run <selected macro()

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Darrell

Try the below macro

Sub CreateMonthSheets()
Dim intTemp
Dim dtTemp As Date
dtTemp = "1/Jan/2009"
ActiveWorkbook.Sheets.Add Count:=(25 - ActiveWorkbook.Sheets.Count)
For intTemp = 2 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Sheets(intTemp).Name = _
Format(DateAdd("m", (intTemp - 2), dtTemp), "mmm-yy")
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Dr. Darrell" wrote:

I want to rename my worksheet tabs to be numbered: Jan-09, Feb-09,
Mar-09...Nov-10, Dec-10

I would like to start the numbering at the second Tab (The first Tab is
"Summary".

Can I place a line of code to perform this?

I am modifying 20 workbooks, so after re-typing the tabs on a couple it
seems there might be an easier way.


Dr. Darrell

I want to rename my worksheet tabs...
 
Jacob:

I have quite a few functions in the worksheets which are linked to several
workbooks, so I would prefer to rename the existing tabs if possible.

"Dr. Darrell" wrote:

I want to rename my worksheet tabs to be numbered: Jan-09, Feb-09,
Mar-09...Nov-10, Dec-10

I would like to start the numbering at the second Tab (The first Tab is
"Summary".

Can I place a line of code to perform this?

I am modifying 20 workbooks, so after re-typing the tabs on a couple it
seems there might be an easier way.


Jacob Skaria

I want to rename my worksheet tabs...
 
Try the below

Sub CreateMonthSheets()
Dim intTemp
Dim dtTemp As Date
dtTemp = "1/Jan/2009"
For intTemp = 2 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Sheets(intTemp).Name = _
Format(DateAdd("m", (intTemp - 2), dtTemp), "mmm-yy")
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Dr. Darrell" wrote:

Jacob:

I have quite a few functions in the worksheets which are linked to several
workbooks, so I would prefer to rename the existing tabs if possible.

"Dr. Darrell" wrote:

I want to rename my worksheet tabs to be numbered: Jan-09, Feb-09,
Mar-09...Nov-10, Dec-10

I would like to start the numbering at the second Tab (The first Tab is
"Summary".

Can I place a line of code to perform this?

I am modifying 20 workbooks, so after re-typing the tabs on a couple it
seems there might be an easier way.


Dr. Darrell

I want to rename my worksheet tabs...
 
Thank You; this seems to do the trick.

"Jacob Skaria" wrote:

Try the below

Sub CreateMonthSheets()
Dim intTemp
Dim dtTemp As Date
dtTemp = "1/Jan/2009"
For intTemp = 2 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Sheets(intTemp).Name = _
Format(DateAdd("m", (intTemp - 2), dtTemp), "mmm-yy")
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Dr. Darrell" wrote:

Jacob:

I have quite a few functions in the worksheets which are linked to several
workbooks, so I would prefer to rename the existing tabs if possible.

"Dr. Darrell" wrote:

I want to rename my worksheet tabs to be numbered: Jan-09, Feb-09,
Mar-09...Nov-10, Dec-10

I would like to start the numbering at the second Tab (The first Tab is
"Summary".

Can I place a line of code to perform this?

I am modifying 20 workbooks, so after re-typing the tabs on a couple it
seems there might be an easier way.



All times are GMT +1. The time now is 08:13 AM.

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