I greet you,I have the following problem:A worksheet with two sheetsin sheet 2 I want to block only the first 2 columns so that they cannot be modified/deleted and the rest remain editable.in sheet 1, the row corresponding to sheet 2 can be edited, deleted, but above all, ctr+d should work in both sheets.
I tried the code below in sheet 2 but.....
Ctrl+d doesn't work and in addition it blocks my entire row, not just columns B and C as I wanted.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Whoa
Application.EnableEvents = False
If Not Intersect(Range(Target.Address), Range("B24", Range("C24").SpecialCells(xlCellTypeLastCell))) Is Nothing Then
Application.Undo
'End If
LetsContinue:
Application.EnableEvents = True
Exit Sub
Whoa:
MsgBox Err.Description
Resume LetsContinue
End Sub
I tried the code below in sheet 2 but.....
Ctrl+d doesn't work and in addition it blocks my entire row, not just columns B and C as I wanted.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Whoa
Application.EnableEvents = False
If Not Intersect(Range(Target.Address), Range("B24", Range("C24").SpecialCells(xlCellTypeLastCell))) Is Nothing Then
Application.Undo
'End If
LetsContinue:
Application.EnableEvents = True
Exit Sub
Whoa:
MsgBox Err.Description
Resume LetsContinue
End Sub