Place this macro in the worksheet code module. Right click the tab name, click 'View Code', paste the code into the empty module that opens up, close the module. Enter a number in column B.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
Range("Table1[#All]").Select
ActiveWorkbook.Worksheets("faults").ListObjects("Table1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("faults").ListObjects("Table1").Sort.SortFields.Add _
Key:=Range("Table1[no. returns]"), SortOn:=xlSortOnValues, Order:= _
xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("faults").ListObjects("Table1").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.ScreenUpdating = False
End Sub
Bookmarks