+ Reply to Thread
Results 1 to 2 of 2

vba excel autofilter failure

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    vba excel autofilter failure

    I have tables to run some calculations where each table is filtered by a list of variables set in sFilter(i). Not all tables have the same variable, so when running my loop, an error is thrown on tables that don't contain a variable in the list. How can I just check if the variable sFilter(i) is nothing or False when:
    For i = 1 To 4
      With rng
        .AutoFilter Field:=7, Criteria1:=sFilter(i)
      End With
    'code
    Next i

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: vba excel autofilter failure

    try

    For i = 1 To 4
      With rng
        .AutoFilter 
        .AutoFilter Field:=7, Criteria1:=sFilter(i)
      End With
    'code
    Next i

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. AutoFilter Failure
    By Narlyb in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  2. AutoFilter Failure
    By Narlyb in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-24-2005, 05:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1