Hi All,
I am trying to create a dynamic macro to sort a table in excel 2007. I have created the code below. I am hoping to be able to replace the specific table names to the 'active table #' if possible. Can someone point me in the right direction? I appreciate the help. Sincerely. Pancho
Sub Macro1()
ActiveWorkbook.Worksheets("Sheet3").ListObjects("Table4").sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet3").ListObjects("Table4").sort.SortFields.Add _
Key:=Range("Table4[[#All],[Price$]]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet3").ListObjects("Table4").sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
I am trying to create a dynamic macro to sort a table in excel 2007. I have created the code below. I am hoping to be able to replace the specific table names to the 'active table #' if possible. Can someone point me in the right direction? I appreciate the help. Sincerely. Pancho
Sub Macro1()
ActiveWorkbook.Worksheets("Sheet3").ListObjects("Table4").sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet3").ListObjects("Table4").sort.SortFields.Add _
Key:=Range("Table4[[#All],[Price$]]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet3").ListObjects("Table4").sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub