I am a total rookie and trying to solve an issue on a spreadsheet we use. The initial issue was when I had the column locked the sorting wasn't working properly. I tried a few methods that I found and had the best result by forcing anything entered into the column to be undone. The column has a formula in it and this also prevents that from being deleted; but not in all cases.
The issue I have is that if you select column C and other columns at the same time and hit delete the undo action isn't working and the formula gets wiped out.
This is what I have currently, any help would be awesome!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range, Trgt As Range, MyRow As Long
Set MyRange = Intersect(Target, Range("c2:c498,a1:j1"))
Set Trgt = Range("c499")
If Target.Locked = True Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub
The issue I have is that if you select column C and other columns at the same time and hit delete the undo action isn't working and the formula gets wiped out.
This is what I have currently, any help would be awesome!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range, Trgt As Range, MyRow As Long
Set MyRange = Intersect(Target, Range("c2:c498,a1:j1"))
Set Trgt = Range("c499")
If Target.Locked = True Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub