Link to home
Start Free TrialLog in
Avatar of Skylar
Skylar

asked on

how to lock some ranges using VBA

how can i lock multiple ranges in sheet2 using VBA

i am using
ThisWorkbook.Worksheets("Sheet2").Cells.Locked = False
ThisWorkbook.Worksheets("Sheet2").Range("B8:C9,B5:C6,D1:R1,Q4:R4,A12:S17,A19:S33").Locked = True


it is not changing the cell to locked. the locked tick mark does not get ticked when i run the above code. i do not know why
ASKER CERTIFIED SOLUTION
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Skylar
Skylar

ASKER

THANKS.