The following code works perfectly but, I cannot get it to sort when the page is protected. I want to protect it so that people cannot make any other unauthorized changes but still be able to enter data into the Issued Hours column and have the columns sort when the Total Hours column changes
Any thought would be greatly appreciated.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then ' Total Hours
With Range("A1:E" & Range("E30").End(xlUp).Row)
.Sort key1:=Range("D2"), order1:=xlAscending, key2:=Range("E2"), order2:=xlAscending, header:=xlYes, ordercustom:=1, MatchCase:=fasle, _
Orientation:=xlSortColumns
End With
End If
If Target.Column = 5 Then
Range("D" & Target.Row).Value = Range("D" & Target.Row).Value + _
Cells(Target.Row, Target.Column).Value
End If
End Sub