Reset Button

bpgolferguy

Active Member
Joined
Mar 1, 2009
Messages
469
Is it possible to create a "reset" button in excel that when clicked will reset and clear everything that is in the unlocked cells the user can modify? If so, can you give me the macro code? Thanks!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Try

Code:
Sub clr()
Dim c As Range
For Each c In ActiveSheet.UsedRange
    If c.Locked = False Then c.ClearContents
Next c
End Sub
 
Upvote 0
ok for one the workbook is protected with some cells unlocked, and not Knowing the unloaked cell you can not wright code.

but you can type any thange in each cell that a user will type in, then hit record a macro and go to each cell and delet the info.

when you are done, stop the macro , theirs you reset.
 
Upvote 0
That code listed above gives me an error message when I click the button....is that the exact code I should copy and paste into the code area? Do I need something before or after it?
 
Upvote 0
Can you post the exact code that you've assigned to the button. What's the error?
 
Upvote 0
Here is the code:

Sub Button29_Click()
Sub clr()
Dim c As Range
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then c.ClearContents
Next c
End Sub
End Sub

It says "compile error"
 
Upvote 0
Try this:

Code:
Sub Button29_Click()
Dim c As Range
For Each c In ActiveSheet.UsedRange
    If c.Locked = False Then c.ClearContents
Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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