John Caines
Well-known Member
- Joined
- Aug 28, 2006
- Messages
- 1,155
- Office Version
- 2019
- Platform
- Windows
Hello All.
I'm tring to create a simple (Though not for me)
Clear macro.
All I'm looking to do is just add 1 more line of code/text,,, and I'm not sure how to do it.
So far the VBA I have is as follows;
The line I would like to add is just after the line that says, " "Are You Sure You Want To Delete ALL Your Entered Data?"
IF they click NO,,, I would like to display another message that just says;
"No problem, nothing will be cleared."
Can anybody show me how this would be inserted please, I've tried a few attempts but just can't seem to get it right. ;-(
I hope the above makes sense.
many Thanks;
John Caines
I'm tring to create a simple (Though not for me)
Clear macro.
All I'm looking to do is just add 1 more line of code/text,,, and I'm not sure how to do it.
So far the VBA I have is as follows;
Code:
Sub Clear_All_Data()
If WorksheetFunction.CountA(Range("E24:E274,H24:I274,J23:K274,O24:O274")) = 0 Then
MsgBox "Sorry, No Data to Clear :-)"
Else
If MsgBox("Are You Sure You Want To Delete ALL Your Entered Data?", vbYesNo + vbCritical) = vbYes Then
Range("E24:E274,H24:I274,J23:K274,O24:O274").ClearContents
MsgBox "All Your Entered Details Have Now Been Cleared", vbInformation
End If
End If
End Sub
The line I would like to add is just after the line that says, " "Are You Sure You Want To Delete ALL Your Entered Data?"
IF they click NO,,, I would like to display another message that just says;
"No problem, nothing will be cleared."
Can anybody show me how this would be inserted please, I've tried a few attempts but just can't seem to get it right. ;-(
I hope the above makes sense.
many Thanks;
John Caines