运行时错误' 91'

时间:2017-10-03 14:16:12

标签: excel vba excel-vba

我有以下代码,我得到了运行时错误' 91'问题。我是VBA脚本新手并使用excel制作宏。提前致谢。

Sub ProjectType_Sort()
'
' ProjectType_Sort Macro
'

'
    ActiveWorkbook.Worksheets("P09").AutoFilter.Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("P09").AutoFilter.Sort.SortFields.Add 
        Key:=Range(_"G4"), SortOn:=xlSortOnValues, Order:=xlAscending, 
        DataOption:= _xlSortNormal
    With ActiveWorkbook.Worksheets("P09").AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Selection.AutoFilter
    Range("G12").Select
End Sub

0 个答案:

没有答案