vba to automatically switch on cell protection in unprotected cells

CRL_IM1

New Member
Joined
Feb 6, 2015
Messages
4
Hi I have a locked table in which some columns contain protected cells which always remain locked by the macro. Other columns are not protected to enable users to input data or select drop down menus. I need to change the unprotected cells in a row into protected cells so the macro will then protect an entire row once an x is input to the cell in column AG.

The idea being a reviewer can verify the data in the row and then lock it down by inputting a value x into the cell in column AG - locking it against any further change without a password.

Thanks in advance

I
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Should have mentioned I have tried the macro recorder version of the cell protection and tried to mix with a piece of code from something similar.


For Each cell In Range("AG3:AG500")

ActiveSheet.Unprotect "Password"

If cell.Value = "X" Then .Select

ActiveCell(1, -3).Select
Selection.Locked = True
Selection.FormulaHidden = False

ActiveSheet.Protect "Password"

End If

Next cell

End Sub
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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