I need create a spreadsheet with a sequential date over multiple tabs with macro in excel.
I need six tabs in the first tab the actual date and the next tabs with sequential dates.
I find this code but not work for me.
Dim n As Integer
Dim i As Integer
Dim dt As Date
While Worksheets.Count > 1
Application.DisplayAlerts = False
Worksheets(2).Delete
Application.DisplayAlerts = True
Wend
dt = Cells(1, 1).Value '<==== Error in this line of code
n = DateSerial(Year(dt), Month(dt) + 1, 0) - dt + 1
Sheets(1).Name = Format(dt, "mmm dd yyyy")
For i = 2 To n
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(i).Name = Format(DateAdd("d", 1, CDate(Sheets(i - 1).Name)), "mmm dd yyyy")
Next i