1 Attachment(s)
Excel Macro to Sort Data if a value changes in defined range
Hi,
I am trying to auto short(descending) values if a value changes in range D4 to D9. Attaches is the excel file and below is the code I am trying (seems I am doing something wrong).
Please help.
Attachment 379
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D4:D8")) Is Nothing Then
Call DataS
End If
End Sub
Sub DataS()
Range("B3:E8").Sort _
Key1:=Range("E3"), Order1:=xlDescending, Header:=xlYes
End Sub
Thanks
Rajesh