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: 18
Default Need sopme help coding Dates and Sheet names. (Please)

I could use some help codeing please...


There have 5 worksheets, each a week of the month. From the Year and
month inputed, it should name each sheet by the last day in each week.
(Saturday) All the lines with a ' starting it was code I was not sure
how to write. (some code ommited to clean things up)

The following data is selected on the first Sheet. D2 = Month(TEXT)
H2= Year(Number)


If Not IsEmpty(D2) And Not IsEmpty(H2) Then
'SET SHEETDATE Month(D2) Year (H2) DAy(First Saturday of the Month)
For Each Sh In ThisWorkbook.Worksheets
If Sh.Index < 6 Then
Worksheets(Sh.Index).Activate
SheetDate = DateAdd("ww", (Sh.Index - 1), SheetDate)
'If this date is Not Past the end of the month in D2 Then
Sh.Name = Format(SheetDate, "mmm-dd")
'Else
Sh.Name = "Week " & Choose(Sh.Index, " 1", " 2", " 3", "
4", " 5")
'End if
End If
Next
End If

For example if D2 = Feburary and H2 = 2005 Then the sheets would name
them selfs like so :

Sheet 1 Renamed to Feb-05
Sheet 2 Renamed to Feb-12
Sheet 3 Renamed to Feb-19
Sheet 4 Renamed to Feb-26
Sheet 5 Renamed to Week 5

 
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
VBA coding for expiry dates alert threw email Tia[_3_] Excel Worksheet Functions 1 July 20th 09 03:12 PM
Color coding dates in excel Hilly New Users to Excel 7 April 2nd 09 12:05 PM
work sheet coding Dad Excel Discussion (Misc queries) 3 December 23rd 07 11:08 PM
Hidding Macro names and coding mrbalaje Excel Discussion (Misc queries) 4 April 20th 05 04:23 PM
Coding to check for a sheet name and add it if it's not there AlanN Excel Programming 2 August 21st 03 09:17 PM


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