LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default How to rename worksheet like "Jan. 2006"

I modified your code a bit to work.

Sub SchedSheets()
Dim mon As String
Dim monArr() As String
mon = "Jan.Feb.Mar.Apr.May.Jun.Jul.Aug.Sep.Oct.Nov.D ec."
monArr = Split(mon, ".")
Dim ws As Worksheet
Worksheets(3).Select
m = Month(Date)
Dim sheetName As String
While m <= UBound(monArr)
If monArr(m - 1) < "" Then
sheetName = monArr(m - 1) & " " & Year(Date)
Worksheets.Add after:=ActiveSheet
ActiveSheet.Name = sheetName
m = m + 1
End If
Wend
End Sub

keizi

"Jeffery B Paarsa" wrote in message
...
Sorry guys before I enter the text I accidently hit the enter key... Here
is
the question:

Hello all,

In a VBA macro I running the following code hoping to create a maximum
number of 12 worksheets after worksheet number 3 with the worksheet name
of
"Jan. 2007", "Feb. 2007"....etc... What am I doing wrong... Beleive me I
spent at least 2 hours in search to find an example code with no
success....

Private Sub SchedSheets()
Dim mon As String
Dim monArr() As String
mon = "Jan.Feb.Mar.Apr.May.Jun.Jul.Aug.Sep.Oct.Nov.D ec."
monArr = Split(mon, ".")
Dim ws As Worksheet
Dim mm As Integer
Dim i As Integer
i = 3
m = Month(Date)
Dim sheetName As String
While mm < 13
sheetName = monArr(m) & " " & Year(Date)
Worksheets.Add after:=Sheets(i)
ActiveWorksheet.Name = sheetName
i = i + 1
m = m + 1
Wend
End Sub

--
Jeff B Paarsa


"Jeffery B Paarsa" wrote:


--
Jeff B Paarsa


 
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 rename worksheet like "Jan. 2006" Bob Phillips Excel Programming 0 December 12th 06 11:14 PM
=DATEDIF(3/31/2006,4/30/2006,"m") equals 0? John Taylor Excel Discussion (Misc queries) 2 October 8th 06 12:32 PM
=DATEDIF(3/31/2006,4/30/2006,"m") equals 0? Dave F Excel Discussion (Misc queries) 4 October 8th 06 11:17 AM
Problem: Worksheets("New Style 2006").Unprotect Password:="naPrint" Karoo News[_2_] Excel Programming 1 January 30th 06 02:40 PM
How to use macro to rename worksheet with date +"text" Sherri[_3_] Excel Programming 4 April 28th 04 12:05 AM


All times are GMT +1. The time now is 07:40 AM.

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

About Us

"It's about Microsoft Excel"