Results 1 to 6 of 6

VBA to actvate Unfilter after Auto Filter

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-01-2008
    Location
    Perth, Australia
    MS-Off Ver
    Excel 365
    Posts
    135

    VBA to actvate Unfilter after Auto Filter

    Hi All,

    I have pieced together the below code to autofilter a workbook based on the cell entry in Sheet 1, A1. The code works great whilst sorting the information, but has a run time error when entry is " ", this entry should unsort all infomation in the previously sorted sheets.
    I would also like the first two sheets excluded from the sort and the code to run on the cell change.

    Sub DoFilters()
        Dim w As Worksheet, RLetter As String
        Dim Crit    As String
        Crit = Sheets("Sheet1").Range("A1").Value
        RLetter = Crit
        For Each w In Worksheets
        
        If RLetter = "" Then w.Cells.AutoFilter
        w.Range("A:A").AutoFilter.false
        
        If w.FilterMode Then w.Cells.AutoFilter
        w.Range("A:A").AutoFilter Field:=1, Criteria1:=Crit
    
        Next
    End Sub
    Any help is much appreciated

    Cheers

    Adam
    Last edited by VBA Noob; 09-19-2008 at 01:52 AM. Reason: Poor title

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto Filter Limitations
    By taichi56 in forum Excel General
    Replies: 3
    Last Post: 06-08-2008, 04:12 PM
  2. Top ten not using Auto Filter
    By celestialspring in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-23-2007, 03:32 AM
  3. Auto Filter
    By new@this in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2007, 11:04 AM
  4. auto filter
    By sach0025 in forum Excel General
    Replies: 3
    Last Post: 02-08-2007, 03:52 PM
  5. Custom Auto Filter for more than two cells
    By coopster in forum Excel General
    Replies: 2
    Last Post: 02-07-2007, 09:23 AM

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