View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Roger Govier[_3_] Roger Govier[_3_] is offline
external usenet poster
 
Posts: 2,480
Default Date formats change (code included)

Hi Paolo

I created a file for making Monthly workbooks with days of month as
worksheets.
It is available for download at
http://excelusergroup.org/media/p/236.aspx
See if the code there helps you in any way.

--
Regards
Roger Govier

"Paolo" wrote in message
...
I currently have a worksheet that uses VBA code which creates a worksheet
for
each day of the month using the MMM-d date format. It works fine this way
but
it would be better if I could get it to name each sheet as 1st through
31st
NOT Jan-1 through Jan-31. A section of the code follows:


Do While i < 32 'counting 31 loops
If Month(firstday + i) = mon Then 'checking to see if 31st day is
still within the month
dayofweek = Weekday(firstday + i) 'retrieving day of the week from
date
currentday = firstday + i 'calculating loop date
currentday = Format(currentday, "mmm-d") 'formatting loop day for
tab
name
Select Case dayofweek 'choosing correct kind of
template
Case 1, 7 'weekend template
Sheets("Summer Weekend").Select 'select weekend template
Sheets("Summer Weekend").Copy Befo=Sheets(1) 'pasting copy
as first
Sheets("Summer Weekend (2)").Select
Sheets("Summer Weekend (2)").Name = currentday 'changing tab
name to loop date
Case 2, 3, 4, 5, 6 'weekday template
Sheets("Summer Weekday").Select
Sheets("Summer Weekday").Copy Befo=Sheets(1)
Sheets("Summer Weekday (2)").Select
Sheets("Sum