Add button to excel that is able to lock/unlock certain cells

excelnewbie132

New Member
Joined
Mar 12, 2019
Messages
1
Hi there!

I am new to this site and pretty much anything macro related.

I have a spreadsheet that I am trying to add a button and want it to have a macro on it that can lock/unlock the sheet or certain cells. I know that you can go to the "Review" tab and then protect the sheet or workbook from there, but I have a reason why I want a button.

This spreadsheet has a ton of formulas in it, and is going to be used by myself and many coworkers and then we will send to a client. I want my coworkers to be able to edit certain cells and then lock those cells before sending to the client. The reason I want a button is to make it as easy as possible for my coworkers to lock and remember to lock the cells before sending to clients. The button would help for those who don't know how to get to the protect sheet area on the review tab or forget, etc. Not everyone is excel savvy :)

Is this possible to do?

Thank you!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi,

It's simple enough. What exactly needs to be done, will you already have it setup ready to lock?

Just add a button or picture, and assign macro. Code as follows

Code:
Sub UnProtect()


Sheets("Sheet1").UnProtect Password:="myPassword"


End Sub


Sub Protect()


Sheets("Sheet1").Protect Password:="myPassword"


End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,058
Latest member
oculus

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