Private
Sub
CommandButton5_Click()
Dim
TableName
As
String
LastRowXML = Sheets(
"XML PowerQuery"
).Cells(Rows.Count, 1).
End
(xlUp).Row
TableName = ListObjects(1)
ActiveWorkbook.Worksheets(
"XML PowerQuery"
).ListObjects(TableName).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(
"XML PowerQuery"
).ListObjects(TableName).Sort.SortFields.Add2 Key:=Range(
"VP_L1__5[systemdate]"
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
With
ActiveWorkbook.Worksheets(
"XML PowerQuery"
).Sort
.Header = xlYes
.MatchCase =
False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End
With
End
Sub