Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Lock Row (A~F) based on criteria in g
I have lot of data in sheet 1 (for whole years) I want to lock cell from A~F when in cell G i give some criteria Like Posted. Whole the sheet remain unprotected.
Regards Noor |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lock Row (A~F) based on criteria in g
nhkhurum wrote:
I have lot of data in sheet 1 (for whole years) I want to lock cell from A~F when in cell G i give some criteria Like Posted. Whole the sheet remain unprotected. To lock all of the cells in A:F in the current row based on the contents of G [current row], it's like this: Sub lockWhenCriteriaMet1() Dim cell As Range For Each cell In Range("G:G") If cell.Value = criteria Then Range("A" & cell.Row & ":F" & cell.Row).Locked = True End If Next End Sub If the cells are locked individually, based on G, then it's more like this: Sub lockWhenCriteriaMet2() Dim cell As Range For Each cell In Range("G:G") Select Case cell.Value Case criteria_A Cells(cell.Row, 1).Locked = True Case criteria_B Cells(cell.Row, 2).Locked = True 'etc... End Select Next End Sub -- Sacrificing minions: is there any problem it CAN'T solve? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Query criteria based on a changing criteria list | Excel Discussion (Misc queries) | |||
Need to lock data based on '=today()' value | Excel Programming | |||
lock cells based on formula | Excel Programming | |||
lock cell based on a condition | Excel Worksheet Functions | |||
How to lock a row in a spreadsheet based on the value in a cell | Excel Worksheet Functions |