Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I need to lock cells in a column based on a value in another column.
So if value en column B is "1" then cell in same row in column A will be locked else unlocked. I have tried this setup: Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo enditall Application.EnableEvents = False If Target.Address = "$A$1" Then ActiveSheet.Unprotect ActiveSheet.Cells.Locked = False If Target.Value = "1" Then Range("B1:b10").Cells.Locked = True End If ActiveSheet.Protect End If enditall: Application.EnableEvents = True End Sub But if only locks based on the value in af fixed celle A$1$, and i cant seem to find have to adjust it, so condition in column A and locking af cell in column B work for each row individual. I've seen in other topics on this board, that data validation can be used - ived tried it, and it works so that you cannot change data i the cell, BUT you can delete!! - so the data validation is not an option for me in this case. Can anyone help me? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Locking rows | Excel Discussion (Misc queries) | |||
Conditional Cell Locking | Excel Worksheet Functions | |||
locking formula in cells in without locking whole sheet | Excel Discussion (Misc queries) | |||
locking rows | Excel Discussion (Misc queries) | |||
Locking Code In Individual Macros | Excel Discussion (Misc queries) |