Hello, I have a daily time tracking file with a macro that adds a new tab with date + 1.
This is the code:
1) Rather than have the new sheet inserted at the end right of the work book or after the latest date; I'd prefer to have it inserted at the beginning or at least before the latest date.
2) When ever I save, close, and reopen the file I run into issues and the file has to be 'repaired' and I'm not sure why this is happening:
The "Template" sheet referenced in the code has two tables: one is just a regular table with data validation drop down list for activities with time in 15" increments, and the other is a pivot table of the first table which summarizes the activity counts and sums the hours. As this process iterates, clearly a lot of tables are getting created but not sure why this problem keeps occurring.
Grateful for any insights/guidance!
Thanks,
Steve
This is the code:
VBA Code:
Sub Add_New_Sheet()
Application.ScreenUpdating = False
Dim wshL As Worksheet
Dim wshN As Worksheet
Dim d As Date
Set wshL = Worksheets(Worksheets.Count)
d = DateValue(wshL.Name)
wshL.Copy After:=wshL
Set wshN = ActiveSheet
wshN.Name = Format(d + 1, "mm-dd-yy")
Worksheets("Template").Columns("B:D").Copy wshN.Range("A1")
wshN.Range("E2").PivotTable.SourceData = _
wshN.Range("A1").CurrentRegion.Address(, , xlR1C1, True)
ActiveWindow.Zoom = 90
Application.ScreenUpdating = True
End Sub
1) Rather than have the new sheet inserted at the end right of the work book or after the latest date; I'd prefer to have it inserted at the beginning or at least before the latest date.
2) When ever I save, close, and reopen the file I run into issues and the file has to be 'repaired' and I'm not sure why this is happening:
The "Template" sheet referenced in the code has two tables: one is just a regular table with data validation drop down list for activities with time in 15" increments, and the other is a pivot table of the first table which summarizes the activity counts and sums the hours. As this process iterates, clearly a lot of tables are getting created but not sure why this problem keeps occurring.
Grateful for any insights/guidance!
Thanks,
Steve