muhammad susanto
Well-known Member
- Joined
- Jan 8, 2013
- Messages
- 2,102
- Office Version
- 365
- 2021
- Platform
- Windows
hi all...
i have macro code to prevent delete in a cell..
this code :
that's code is working but if i select in multiple cell e.g. drag / block from A2 to A5 then Press Del , the macro can't working, show "Type mismatch" then cell is deleted...
how to still keep or prevent the data can't delete when i delete for each cell or multiple cell...
thanks in advance...
m.susanto
i have macro code to prevent delete in a cell..
this code :
Code:
Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo Whoa
Application.EnableEvents = False
If Not Intersect(Target, Range("A2:A5,B2:B5")) Is Nothing Then
If Len(Trim(Target.Value)) = 0 Then Application.Undo
End If
LetsContinue:
Application.EnableEvents = True
Exit Sub
Whoa:
MsgBox Err.Description
Resume LetsContinue
End Sub
that's code is working but if i select in multiple cell e.g. drag / block from A2 to A5 then Press Del , the macro can't working, show "Type mismatch" then cell is deleted...
how to still keep or prevent the data can't delete when i delete for each cell or multiple cell...
thanks in advance...
m.susanto