ShowAllData method of Worksheet class failed

后端 未结 7 1496
后悔当初
后悔当初 2020-11-28 10:17

I notice my VBA script doesn\'t work when there\'s an autofilter already on. Any idea why this is?

    wbk.Activate
    Set Criteria = Sheets(\"Sheet1\").Cel         


        
7条回答
  •  青春惊慌失措
    2020-11-28 10:51

    The simple way to avoid this is not to use the worksheet method ShowAllData

    Autofilter has the same ShowAllData method which doesn't throw an error when the filter is enabled but no filter is set

    If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilter.ShowAllData

提交回复
热议问题