Using VBA to change cell properties into lock

TPortsmouth

New Member
Joined
Apr 6, 2017
Messages
41
Hello,

I've an issue on how to change other cells into "Lock" based on a specific value.

4liH0Ko.jpg


By default, cells within columns B to F was locked, if relevant row's Control value = "Yes", the same row's Column C, D and E will be unlock.
For example, if Cell A2 = "Yes", then Cell C2:E2 will be unlock.

I've been thinking whether this can be done by a series of Macro below:
1. If the cell value of A2 change, then after update, if A2 is not equal to "Yes", nothing happen.
2. If A2 = "Yes", unlock worksheet with password.
3. Cell properties of C2:E2 change into "Unlock".
4. Lock worksheet with password.

One of the difficulties is: How do I define the range? As above range A2:F6 is just an example, the whole data set can be much larger.
Let's say, it can contain more than a 1000 records.

Any suggestion on this? Thanks.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,215,515
Messages
6,125,279
Members
449,220
Latest member
Excel Master

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