Hello,
I need to writ a macro that will do a loop that selects each sheet, then selects the table in that sheet, then sorts the table. So far I can select the table from one sheet. I know what the names of the other tables will be though. Here is my code so far.
I need to writ a macro that will do a loop that selects each sheet, then selects the table in that sheet, then sorts the table. So far I can select the table from one sheet. I know what the names of the other tables will be though. Here is my code so far.
Code:
Sub SortTable()
Range("Table8").Select
ActiveWorkbook.Worksheets("JUNE").ListObjects("Table8").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("JUNE").ListObjects("Table8").Sort.SortFields.Add _
Key:=Range("Table8[Days Out]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("JUNE").ListObjects("Table8").Sort.SortFields.Add _
Key:=Range("Table8[DATE OUT UNSIGNED]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("JUNE").ListObjects("Table8").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub