ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Clear cell contents with a button (https://www.excelbanter.com/excel-worksheet-functions/16390-clear-cell-contents-button.html)

KFC / A&W Boy

Clear cell contents with a button
 
I have a hour calculator that I got oddly from Microsoft. What I am trying to
do is create a button that clears the two clock in fields and the two clock
out fields but leaves the formatting intact while in a protected sheet mode.
Can anyone help me? Please reply to as I use this email
more than the MSN email

Bob Phillips

Just add this type of macro to the button

Sub ClearCells()
ActiveSheet.Unprotect Password:="Bob"
Range("A1").Value = ""
Range("A2").Value = ""
Range("B1").Value = ""
Range("B2").Value = ""
ActiveSheet.Protect Password:="Bob", DrawingObjects:=True,
Contents:=True, Scenarios:=True
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"KFC / A&W Boy" <KFC / A&W wrote in message
...
I have a hour calculator that I got oddly from Microsoft. What I am trying

to
do is create a button that clears the two clock in fields and the two

clock
out fields but leaves the formatting intact while in a protected sheet

mode.
Can anyone help me? Please reply to
as I use this email
more than the MSN email





All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com