I have 5 different groups (Group 002, 003, 004, 005 and 007) that need to be inserted on different days. 005 on Mondays, 004 on Tuesdays, 003 on Wednesdays, 002 on Thursdays and 007 Fridays Saturdays and Sundays. I started the below code, but as you can see, I don't quite have it correct.
Private Sub Workbook_Open()
Sheet1.Unprotect Password:="cards"
Sheets("Routine").Select
Application.ScreenUpdating = False
On Error Resume Next
ActiveSheet.Shapes("Group 002").Delete ' if they exist
ActiveSheet.Shapes("Group 003").Delete
ActiveSheet.Shapes("Group 004").Delete
ActiveSheet.Shapes("Group 005").Delete
ActiveSheet.Shapes("Group 007").Delete
On Error GoTo 0
If Weekday(Range("L1").Value) > 5 Or Weekday(Range("L1").Value) = 1 Then ' Friday - Sunday
Sheets("Tours").Shapes("Group 007").Copy
Else ' Monday
Sheets("Tours").Shapes("Group 005").Copy
End If
ActiveSheet.Paste
Selection.Left = 0
Selection.Top = 1038
Sheet1.Protect Password:="cards"
End Sub
Bookmarks