Hi Rajesh,
I have put the following code together with should work but VBA isn't my best subject. The problem is going to be when you want the code to run and also in order for locked cells to take effect the workbook must be protected which yours is not. Left me know what you think and we can change the code to suit.
Code:Sub LockNonactive() Dim nonAct As Range Dim CheckValue As String Set nonAct = ActiveSheet.Range("C3:C10") CheckValue = "Left" CheckValue = "Resigned" ActiveSheet.Unprotect For Each Cell In nonAct If Cell.Value = CheckValue Then Cell.EntireRow.Locked = True Next ActiveSheet.Protect End Sub




. The problem is going to be when you want the code to run and also in order for locked cells to take effect the workbook must be protected which yours is not. Left me know what you think and we can change the code to suit.
Reply With Quote
Bookmarks