I've an workbook_open macro as below;
Private Sub Workbook_Open()
Sheets("Staff List").Activate
If Range("G1") = "Yes" Then
Sheets(Format(Now, "mmmm")).Activate
Range("A1").Select
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
End If
End Sub
The formula in G1 is as below;
=IF(OR(TODAY()=WORKDAY(EOMONTH(TODAY(),-1),1,0),TODAY()=WORKDAY(EOMONTH(TODAY(),-1),2,0)),"Yes","No")
So checking to see whether today is either the first or second working day of a month. How would remove the need to reference G1 and instead work the formula directly into the VBA?
Many thanks