Results 1 to 2 of 2

Thread: [RESOLVED] Why does filtering work only once?

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    San Jose, CA

    Resolved [RESOLVED] Why does filtering work only once?

    In my code I'm filtering on column "X". In the code below column 'X' is represented by COL_CONCAT. If I open the workbook and run the code it works as expected but if I try it again it doesn't and I have to close and reopen the workbook. How can I correct that?

     ' Clear any previous autofiltering
            On Error Resume Next
            On Error GoTo 0
            .Range(.Cells(1, COL_CONCAT), .Cells(lngLastRow1, COL_CONCAT)).AutoFilter Field:=1, Criteria1:="blah"

  2. #2
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Idaho Falls, Idaho USA

    Re: [RESOLVED] Why does filtering work only once?

    Possibly useful link:

    Sub Auto_Open()
        Dim xWs As Worksheet
        For Each Wks In ThisWorkbook.Worksheets
        On Error Resume Next
        If Wks.AutoFilterMode Then
            Wks.AutoFilterMode = False
        End If
        Next Wks
    End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width