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: 17
Default Date formats change (code included)

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
 
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
help with passing date to access as parameter query(code included) Vince Excel Programming 2 December 10th 06 03:15 AM
How would I write a max formula that included color formats? trainer07 Excel Discussion (Misc queries) 2 April 25th 06 12:05 AM
how do i change or make this macro??? pictures and code included dispelthemyth Excel Programming 1 March 17th 06 01:56 PM
how do i change or make this macro??? pictures and code included dispelthemyth Charts and Charting in Excel 0 March 17th 06 01:02 AM
How to Change Date Formats Jessica Excel Discussion (Misc queries) 2 November 1st 05 06:21 PM


All times are GMT +1. The time now is 03:51 PM.

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"