Conditional Protection - HELP!

jamboss

New Member
Joined
Jun 25, 2008
Messages
1
I have been trying to write a macro with no success to conditionally protect some cells.

The spread sheet is set up as follows

Column A Column B Column C
1
1
0
0
1
0

The entry in column A changes based on a formula to 1 or 0.
I want a macro that does the following:

If cell in Column A is 1, then unlock B & C on that row. If cell is column A is 0 then do not unlock B&C on that row.
Then I want it to carry on down the column working all the cells.

Thanks in advance for your help.
James
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,941
What is the code you are currently using? Something like this may work:

Code:
sub unlockCells()
for i = 1 to cells(rows.count,1).end(xlup).row
if cells(i,1).value = 1 then cells(i,2).resize(,2).locked = false else: cells(i,2).resize(,2).locked = true
next i
end sub
Hope that helps.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,190,881
Messages
5,983,383
Members
439,841
Latest member
goodwillhunting

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
Top