t0ny84
Board Regular
- Joined
- Jul 6, 2020
- Messages
- 205
- Office Version
- 365
- 2016
- 2013
- Platform
- Windows
- Mobile
- Web
Hi,
I am hoping someone can point me in the right direction, I am trying to edit my below code so that it:
1) Checks to see if the active sheet is in the array.
2) If the active sheet is in the array then continue running macro.
3) If the active sheet isn't in the array then do nothing.
4) If cancel button on message box is pushed then cancel.
Thanks in advance,
t0ny84
I am hoping someone can point me in the right direction, I am trying to edit my below code so that it:
1) Checks to see if the active sheet is in the array.
2) If the active sheet is in the array then continue running macro.
3) If the active sheet isn't in the array then do nothing.
4) If cancel button on message box is pushed then cancel.
VBA Code:
Sub ClearAssignedColours()
' Resets calendar cells to white.
Application.ScreenUpdating = False
UserForm1.Show vbModeless
Dim confq As String
shtstounhide = Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12")
If ActiveSheet.Name <> worksheets(shtstounhide).name Then
Exit Sub
ElseIf activesheet.name = worksheets(shtstounhide).name then
confq = MsgBox("Are you sure you want to reset the calendar?", vbOKCancel + vbCritical + vbSystemModal, "Confirmation")
If confq = vbCancel Then
Exit Sub
Else
Range("A7:N36").Interior.Color = vbWhite
Range("A37:D42").Interior.Color = vbWhite
End If
End If
End If
Application.ScreenUpdating = True
End Sub
Thanks in advance,
t0ny84