I have a sheet where the cells in col A needs to be protected against selecting, and against changing.
I don't want to protect the sheet, so I'm looking at the two methods below.
Which do you recommend ?
I don't want to protect the sheet, so I'm looking at the two methods below.
Which do you recommend ?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim j As Integer
j = Target.Column
If j = 1 Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox "No change allowed"
End If
End Sub
VBA Code:
OR
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim j As Integer
j = Target.Column
Application.EnableEvents = False
If j = 1 Then
Cells(1,2).Select
MsgBox "No change allowed"
End If
Application.EnableEvents = True
End Sub