The Scenario: I have an Excel sheet which has an (automatically generating) list of dates (every day in the month, except for weekends).
Those dates are in cells A2:A32
and in cells B2:B32
and C2:32
there are some extra details (which aren't really important).
I also have a Macro that activates when I click a command button. The Macro uses those dates to create a new sheet for each date.
The Macro:
Private Sub CommandButton2_Click()
Dim rng As Range
Set rng = Sheets("Sheet1").Range("A2:A32")
Dim wks As Worksheet
For Each cell In rng
On Error Resume Next
If cell.Value <> "" Then
Set wks = Sheets.Add(After:=Worksheets(Worksheets.Count), Type:="C:\Users\User1\Desktop\1.xltx")
wks.Name = cell.Value
wks.Range("B2").Value = cell.Offset(0, 1).Value
wks.Range("B3").Value = cell.Offset(0, 2).Value
End If
Next cell
End Sub
The Question: How do I change the macro so that after every Friday, the macro makes a sheet with a weekly total (that uses another template and is named (if possible) week1, week2, etc).
If it helps, cell B3 has the day of the week written in text (Friday, Monday... etc).