Hi
I have a workbook that I had protected and then unprotected some cells for data to be input.
I then have this macro to protect cells once data put in.
What im trying to do is to be able to clear cells that protected when data input cleared. At present I can only seem to do it by unprotecting whole sheet / clearing cells / reprotect sheet.
Is there any other way round it?
I have a workbook that I had protected and then unprotected some cells for data to be input.
I then have this macro to protect cells once data put in.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range
Set MyRange = Intersect(Range("A1:I999"), Target)
If Not MyRange Is Nothing Then
Sheets("Sheet1").Unprotect Password:="hello"
MyRange.Locked = True
Sheets("Sheet1").Protect Password:="hello"
End If
End Sub
What im trying to do is to be able to clear cells that protected when data input cleared. At present I can only seem to do it by unprotecting whole sheet / clearing cells / reprotect sheet.
Is there any other way round it?