#1   Report Post  
tojo107
 
Posts: n/a
Default Naming worksheets...

I open a workbook each month with a sheet for each day of the month. Is there
an easy way to name the sheets such as 4.02.05,4.03.05,4.04.05 etc?

Thanks,
Tom
  #2   Report Post  
Chip Pearson
 
Posts: n/a
Default

Tom,

You'd need to use VBA code to automate this.


Sub RenameSheets()
Dim N As Long
For N = 1 To 31
If N Worksheets.Count Then
Exit For
End If
Worksheets(N).Name = "4." & Format(N, "00") & ".05"
Next N

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"tojo107" wrote in message
...
I open a workbook each month with a sheet for each day of the
month. Is there
an easy way to name the sheets such as 4.02.05,4.03.05,4.04.05
etc?

Thanks,
Tom



  #3   Report Post  
JulieD
 
Posts: n/a
Default

Hi Tom

here's a macro that insert new sheets for each day of the current month and
name them as you specified in your post:

Sub createsheets()
For i = 1 To Day(DateSerial(Year(Date), Month(Date) + 1, 0))
Worksheets.Add Befo=Worksheets(Worksheets.Count)
ActiveSheet.Name = Format(Now, "m") & "." & Format(i, "00") &
"." & Format((Now), "yy")
Next
End Sub

however, if you want to copy an existing sheet in the workbook to each new
sheet then the code would be

Sub createsheets()
For i = 1 To Day(DateSerial(Year(Date), Month(Date) + 1, 0))
Sheets("Sheet1").Copy Befo=Worksheets(Worksheets.Count)
ActiveSheet.Name = Format(Now, "m") & "." & Format(i, "00") &
"." & Format((Now), "yy")
Next
End Sub

this code will copy whatever is on the current sheet1 to all of the new
sheets - still naming the way you want.

if you need help implementing the code, please post back.
--

Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"tojo107" wrote in message
...
I open a workbook each month with a sheet for each day of the month. Is
there
an easy way to name the sheets such as 4.02.05,4.03.05,4.04.05 etc?

Thanks,
Tom



  #4   Report Post  
tojo107
 
Posts: n/a
Default

Worked perfectly - Thank You!!

"Chip Pearson" wrote:

Tom,

You'd need to use VBA code to automate this.


Sub RenameSheets()
Dim N As Long
For N = 1 To 31
If N Worksheets.Count Then
Exit For
End If
Worksheets(N).Name = "4." & Format(N, "00") & ".05"
Next N

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"tojo107" wrote in message
...
I open a workbook each month with a sheet for each day of the
month. Is there
an easy way to name the sheets such as 4.02.05,4.03.05,4.04.05
etc?

Thanks,
Tom




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to protect and unprotect 30 worksheets in a file every month . Protect & Unprotect Several Worksheets Excel Worksheet Functions 4 January 10th 05 01:29 PM
Protect/unprotect all worksheets Janna Excel Worksheet Functions 2 January 7th 05 01:01 AM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 10:05 PM
naming worksheets Shooter Excel Worksheet Functions 1 December 3rd 04 04:09 PM
Assigning Cells in worksheets to other data in other worksheets. David McRitchie Excel Discussion (Misc queries) 0 November 27th 04 06:15 PM


All times are GMT +1. The time now is 08:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"