Jenkins
asked on
Clear contents of an Excel worksheet with a command button
I've placed a command button on my Excel worksheet.
I want to be able to clear the contents (set them to zero) of cells C3 through C10, D3 through D10 and E3 through E10 by clicking on the button.
Each of the cells is formatted as "Accounting".
However, I want to give the user the chance to opt out of clearing the contents via a VBYesNo message.
Something like "Are you sure you want to clear the contents of this worksheet?"
If the user selects Yes, I not only want the cells' contents to be cleared but for the worksheet to be saved as well.
Thank you.
I want to be able to clear the contents (set them to zero) of cells C3 through C10, D3 through D10 and E3 through E10 by clicking on the button.
Each of the cells is formatted as "Accounting".
However, I want to give the user the chance to opt out of clearing the contents via a VBYesNo message.
Something like "Are you sure you want to clear the contents of this worksheet?"
If the user selects Yes, I not only want the cells' contents to be cleared but for the worksheet to be saved as well.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is a project where a "msgbox" is created from a form that I wrote years ago. One problem you'll face is finding a vbExlamation icon or picture file.
message.zip
message.zip
29077831.xlsm