Locking and Hiding cells is done through : right click on cell... format... protection tab.
By default all cells have lock checked. Uncheck if you do not want protected.
Now go to toolbar and select ... tools.. protection ... protect sheet
Private Sub CommandButton1_Click()
With Selection
Sheets("YOUR SHEET NAME HERE").Unprotect password:="YOUR PASSWORD"
YOUR CODE HERE
End With
Sheets("YOUR SHEET NAME HERE").Protect
password:="YOUR PASSWORD"
End Sub
James
_________________ This message was edited by James on 2002-05-08 11:30
I usually don't bother with a password when protecting the sheets. After all we're just trying to prevent any changes by mistake.
Forget passwords for this stuff it's not worth the bother.
Other then that I totally agree with James suggestion...great solution
_________________
NOTE: Testing performed on Win2K utilizing Office 2000. Solutions may not work on other versions. This message was edited by Nimrod on 2002-05-08 11:30
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.