0
Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "AD13:AD33" Then
    Call OrderByPriorityLvl
    End If
End Sub

Sub OrderByPriorityLvl()

    Rows("13:33").Select
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2 Key:=Range( _
        "AD13:AD33"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet1").Sort
        .SetRange Range("A13:AI33")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Range("A33").Select
End Sub
Joe Mayo
  • 7,501
  • 7
  • 41
  • 60
  • So what is your problem? – David García Bodego Oct 14 '19 at 03:25
  • is `Worksheet_Change` in the worksheet? Or did you just paste it into a module thinking it would work? – braX Oct 14 '19 at 03:47
  • Change `If Target.Address = "AD13:AD33" Then` to `If Not Intersect(Target,Range("AD13:AD33")) is Nothing Then` You may want to see [THIS](https://stackoverflow.com/questions/13860894/why-ms-excel-crashes-and-closes-during-worksheet-change-sub-procedure/13861640#13861640) as well... – Siddharth Rout Oct 14 '19 at 05:10
  • It doesn't call the function when there is a change in the worksheet – Joaquin D Oct 14 '19 at 18:55

0 Answers0