Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to create worksheet with the name "Jan. 2007".....

You beat me to it! here's mine anyway

Sub test()
Dim i As Long, d As Long

d = -15
For i = 0 To 11
d = d + 30
Worksheets.Add(after:=Worksheets(3 + i)).Name = Format(d, "mmm 2007")
Next

End Sub

Assumes dealing with the activeworkbook, at least 3 sheets exist per your
requirement, no same name sheets exist.

Regards,
Peter T

"Don Guillett" wrote in message
...
try

Sub makeshts()
For i = 12 To 1 Step -1
myname = Format(DateSerial(2006, i, 1), "mmm yyyy")
Sheets.Add
ActiveSheet.Name = myname
Next i
End Sub
--
Don Guillett
SalesAid Software

"Jeffery B Paarsa" wrote in message
...
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





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 auto create "backup of filename.xls" in Excel 2007. waykwabu Excel Discussion (Misc queries) 2 November 24th 09 12:35 PM
Is there a "create List dialog box" in Excel 2007 ? Newbee New Users to Excel 5 April 29th 08 11:48 AM
How to create worksheet with the name "Jan. 2007"..... Bob Phillips Excel Programming 0 December 12th 06 11:13 PM
Macro to Create New Worksheet and Reference Cell in Old Worksheet As Tab Name - "Object Required" Error [email protected] Excel Discussion (Misc queries) 4 September 25th 06 01:35 PM
create links to check boxes marked "good" fair"and "bad" pjb Excel Worksheet Functions 3 April 20th 06 02:17 AM


All times are GMT +1. The time now is 05:51 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"