Lock a cell based on adjacent cell value

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
Unlock cell A2. Protect the sheet and run this macro:
Code:
Sub UnlockCell()
    ActiveSheet.Unprotect
    If Range("A3") = "1" Then
        Range("A2").Locked = True
    End If
    ActiveSheet.Protect
End Sub
 
Upvote 0
I need help locking cells in a range that is copied from another sheet based on user input. I am able to change the color with conditional formatting, but can not figure out how to lock out cells that are part pf a header. A simplified example is:

Cells A1:A100 are mostly input cells. However, if a corresponding cell in B1:B100 = 1, the matching "A" cell needs to be locked. What code can I use to make this happen?
 
Upvote 0
What works on sample data very often doesn't work on the actual data. Can you post a screen shot of what your data looks like? Section B at this link has instructions on how to post a screen shot: https://www.mrexcel.com/forum/board-announcements/127080-guidelines-forum-use.html Alternately, you could upload a copy of your file to a free site such as www.box.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Include a detailed explanation of what you would like to do referring to specific cells, ranges and worksheets particularly what you mean by
locking cells in a range that is copied from another sheet based on user input.
If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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