milt2010
Board Regular
- Joined
- Dec 18, 2010
- Messages
- 118
Hi,
I need a code to disable the deletion in different ranges of the same unprotect worksheet. Eg.: in range A1: H13; in range B18:H18; in range B24:H24 and so on.
I found this code that is partially good for my needs:
But it work only in a range!
What I should change in this code to do this?
Thanks
I need a code to disable the deletion in different ranges of the same unprotect worksheet. Eg.: in range A1: H13; in range B18:H18; in range B24:H24 and so on.
I found this code that is partially good for my needs:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
If Application.Intersect(Target, Range("C1:F150")) Is Nothing Then Exit Sub
For Each Cell In Target.Cells
If Len(Cell.Value) = 0 Then
Application.EnableEvents = False
Application.Undo
MsgBox "Please don't clear cells in this range."
Application.EnableEvents = True
Exit For
End If
Next Cell
End Sub
But it work only in a range!
What I should change in this code to do this?
Thanks