如果列A值更改,如何使排序宏继续

时间:2017-08-09 18:38:15

标签: excel

你好我有这个vb代码为我的表排序宏。如果A列中的值更改(日期),我想继续更新此代码。任何人都可以帮助我吗?

Sub Macro1()
'
' Macro1 Macro

Range("A6:K6").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("Cash Flow").ListObjects("Table1").Sort.SortFields. _
        Clear
ActiveWorkbook.Worksheets("Cash Flow").ListObjects("Table1").Sort.SortFields. _
        Add Key:=Range("A6"), SortOn:=xlSortOnValues, Order:=xlAscending, _
            DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Cash Flow").ListObjects("Table1").Sort
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
End With
End Sub

0 个答案:

没有答案