Lock a range of cells with VBA and CommandButton

Chris Allen

New Member
Joined
May 13, 2018
Messages
1
Good day all,

I am working a project that allows multiple people to contribute to a worksheet. So that people do not edit information after someone has completed a section of the form, I would like to lock parts of the worksheet.

Ideally I want a command button on the worksheet that locks a range of cells. The user would enter their information into the worksheet and when they have completed all the necessary fields they can click the command button to lock a part of the worksheet.

The work sheet currently has three sections. Section one covers rows 3 - 62, Section 2 rows 63 - 178 and Section 3 rows 179 - 257.

Each section would have a command button to lock it, so would have 3 buttons.

The user would not need to enter a password to activate the lock, but a password would be need to unlock the range of cells, (which only I and some managers would know), just in case the user inputs the wrong information and locks it without realizing their mistake.

I have many cells that are merged cells, which has been giving me additional problems.

Any help will be greatly welcome.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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