I'm trying to unlock a specified range but get the above mentioned error.
My code:
Dim historyWks As Worksheet
Dim nextRow As Long
Public Const lCellsDE As Long = 11
Set historyWks = Worksheets("Invoices")
With historyWks
nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
End With
With historyWks
Set rngProtect = Range(.Cells(nextRow, 1), .Cells(nextRow, lCellsDE))
.Unprotect
Range(rngProtect).Locked = False
.Protect
End With
What am I doing wrong?
Thanks
My code:
Dim historyWks As Worksheet
Dim nextRow As Long
Public Const lCellsDE As Long = 11
Set historyWks = Worksheets("Invoices")
With historyWks
nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
End With
With historyWks
Set rngProtect = Range(.Cells(nextRow, 1), .Cells(nextRow, lCellsDE))
.Unprotect
Range(rngProtect).Locked = False
.Protect
End With
What am I doing wrong?
Thanks