Solved macro to enter dates on tab

May 25, 2011 at 16:17:15
Specs: Windows XP
I need a macro that will enter the dates on the tab like this... Wed June 01, etc. And I need it to keep going till the end of the year. HELP

See More: macro to enter dates on tab

Report •


#1
May 26, 2011 at 04:53:13
✔ Best Answer
In a new workbook with 3 sheets, this code will delete sheets 2 & 3 and then add and name sheets starting with Wed June 01 and ending with Sat December 31.

Sub DailySheets()
'Turn off alerts so that sheets can be deleted without warning
 Application.DisplayAlerts = False
'Delete Sheet 2 and 3
   Sheets(Array("Sheet2", "Sheet3")).Delete
'Set Start date as 5/31/2011
     nxtDay = DateSerial(2011, 5, 31)
'Increment date, rename sheet, add new sheet
      Do Until nxtDay = DateSerial(2011, 12, 31)
        nxtDay = nxtDay + 1
        nxtSht = nxtSht + 1
         Sheets(nxtSht).Name = _
            WeekdayName(Weekday(nxtDay), True) & " " & _
            MonthName(Month(nxtDay)) & " " & _
            WorksheetFunction.Text(Day(nxtDay), "00")
         ActiveWorkbook.Sheets.Add after:=Sheets(Sheets.Count)
      Loop
'Delete extra sheet
   Sheets(Sheets.Count).Delete
'Turn alerts back on
 Application.DisplayAlerts = True
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
May 26, 2011 at 08:02:13
I think I love you. THANK YOU THANK YOU THANK YOU. I need to take a class on macros. Even if I had a cheat sheet (which I looked for on the web), telling me what each symboly means. I know i means 1 and loop means repeat (i think)...just the rest of those dots and dashes. :) Thanks again. I looked all day yesterday to find that.

Report •

#3
May 26, 2011 at 08:48:17
re: "I know i means 1"

Where is there an i that means 1?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Related Solutions

#4
May 26, 2011 at 09:38:04
I guess I don't know then...I could of sworn I read that i mean (1). See...I need to learn these things..ha ha

Report •

#5
May 26, 2011 at 10:49:09
Perhaps if someone used i as a variable and set it equal to 1 or the code itself set it equal to 1, then i could mean 1.

Otherwise, i would just be an empty variable.

Run this code:

 Sub WhatIs_i()
 MsgBox i
  i = 1
 MsgBox i
  i = "Whatever"
 MsgBox i
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •


Ask Question