Jared_Jones_23
New Member
- Joined
- Jun 24, 2011
- Messages
- 34
Hello I am trying to unlock a certain range of cells based on a value in another cell and then protect the sheet for the locked cells. After I run the macro everything in my loop becomes unlocked rather than just the specified range. Any suggestions will be appreciated.
Thank you,
Jared
Dim text2 as string
text2="MLC"
For r = 20 To lastRow
If Cells(r, 18) = text2 Then
Range(Cells(r, 55), Cells(r, lastCol)).Locked = False
End If
Next r
Range(Cells(20, 29), Cells(lastRow, lastCol)).Select 'protects data
ActiveSheet.Protect ("macro"), AllowInsertingRows:=True
Thank you,
Jared
Dim text2 as string
text2="MLC"
For r = 20 To lastRow
If Cells(r, 18) = text2 Then
Range(Cells(r, 55), Cells(r, lastCol)).Locked = False
End If
Next r
Range(Cells(20, 29), Cells(lastRow, lastCol)).Select 'protects data
ActiveSheet.Protect ("macro"), AllowInsertingRows:=True