Reset Button to clear cell value and not cell formatting

mikeb7500

Board Regular
Joined
Jul 30, 2014
Messages
98
On a form I developed, these cells are formatted with a border, color and a drop-down list. I created a RESET BUTTON to clear these cells, but when you press the reset button it also clears the border, color, and the drop-down list. not just the value in the cell.

What code can I use to JUST to only clear the value back to zero in each cell, which is the first option in my drop-down lists?

Also, I would like this reset button to work in a protected worksheet if possible. Any ideas? Thanks!


Sub Clearcells()
Range("G1").Clear
Range("E3").Clear
Range("C4").Clear
Range("C5").Clear
Range("C5").Clear
Range("D7").Clear
Range("C5").Clear
Range("F6").Clear
Range("G5").Clear
Range("E8").Clear
Range("I9").Clear
End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi, I believe you are looking for ClearContents. Use as:

Range("G1").ClearContents
 
Last edited:
Upvote 0
How about
Code:
Sub Clearcells()
   ActiveSheet.Unprotect "Pword"
   Range("C4:C5,D7,E3,E8,F6,G1,G5,I9").ClearContents
   ActiveSheet.Protect "Pword"
End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top