I have created a VBA and have tried to add a MsgBox to confirm I do want to continue. The MsgBox appears but does not respond if I click OK or X.I was hoping to be given a Yes/No choice.
Sub Clear_sheet()
ActiveSheet.Unprotect
Dim AnswerYes As String
Dim AnswerNo As String
AnswerYes = MsgBox("Are you sure?", vbQuestion + YesNo, "User Response")
If AnswerYes = vbYes Then
Range("T32 , AB32").Select
Selection.ClearContents
Range("B4:B32").Select
Selection.ClearContents
Range("W11").Select
Else
End If
ActiveSheet.Protect
End Sub
My code also has many more ranges to ClearContents. I'm wondering if the VBA will be improved with fewer lines with the ranges separated with a comma?
Many thanks for your time.