Hi,
I need your help to check what is wrong with the followibng code. I want the function of clear contents to work based on the value of B4. If I run the code with clear content part excel crushes.


Private Sub Worksheet_Change(ByVal Target As Range)

If Range("B4") = "Basic" Then 

ActiveSheet.Unprotect
'Range("B10,F10,H10").ClearContents '*** if I run this part the excel crushes ***'
Range("B10,F10,H10").Locked = True

Range("D10").Locked = False

ActiveSheet.Protect

Else

ActiveSheet.Unprotect
Range("B10,F10,H10").Locked = False
'Range("D10").ClearContents '*** if I run this part the excel crushes ***'
Range("D10").Locked = True
ActiveSheet.Protect
End If
End Sub


Thanks in advance