+ Reply to Thread
Results 1 to 3 of 3

Hide rows based on autofilter

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Hide rows based on autofilter

    I have a spreadsheet that is split in two parts , one with headers in row 16 with data flowing down to row 190. In row 192 I have another set of headers with data flowing down from that to row 300.

    I have a userform (roughly at cell B13 in the attached) that filters the first block of data into either Company, Syndicate, EU Corporate or ALL. (ignore the other filters) which feature in range B18:B190

    What I want it to do, is that when one of the three options is selected, ie Company, is that all rows from 193 down are hidden other than those that are also Company (in the test case there is just one row). The same is true for when Syndicate or EU Corporate are selected in the userform, and if the ALL is selected then none are hidden.

    hope that makes sense.

    NIck
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Hide rows based on autofilter

    this sort of works... but it looks overly complex and I dont like the fact that I had to fix a range , using the xlup function messed it up...
    as you can see every time a department is selected the formula has to unhide all rows then hide again based on the formula...

    If ComboBox1.Value = "Company" Then
            'Application.ScreenUpdating = False
             Set rng = Range("B193", "B300")
             For Each cel In rng
             cel.EntireRow.Hidden = False
             Next cel
             For Each cel In rng
             If Not cel.Value = "Company" Then
            cel.EntireRow.Hidden = True
             End If
             Next cel
        End If
         
         If ComboBox1.Value = "Syndicate" Then
            'Application.ScreenUpdating = False
             Set rng = Range("B193", "B300")
             For Each cel In rng
             cel.EntireRow.Hidden = False
             Next cel
             For Each cel In rng
             If Not cel.Value = "Syndicate" Then
            cel.EntireRow.Hidden = True
             End If
             Next cel
        End If
        
        If ComboBox1.Value = "EU Corporate" Then
            'Application.ScreenUpdating = False
             Set rng = Range("B193", "B300")
             For Each cel In rng
             cel.EntireRow.Hidden = False
             Next cel
             For Each cel In rng
             If Not cel.Value = "EU Corporate" Then
            cel.EntireRow.Hidden = True
             End If
             Next cel
        End If
        
        If ComboBox1.Value = "ALL" Then
            'Application.ScreenUpdating = False
            Set rng = Range("B193", "B300")
             For Each cel In rng
             
            cel.EntireRow.Hidden = False
             
             Next cel
        End If

  3. #3
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Hide rows based on autofilter

    any help here?

+ 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. [SOLVED] Hide Rows when using autofilter by macro problem
    By Abbadon486 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2014, 11:15 AM
  2. HIde rows based on SpecialCells(xlCellTypeVisible) in row above with autofilter on
    By bradmcq in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-22-2010, 07:01 PM
  3. combining hide columns with autofilter rows
    By f1nman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-25-2008, 01:42 PM
  4. [SOLVED] Hide rows that are empty without autofilter between data
    By Tony in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2006, 11:10 PM
  5. faster way to hide rows w/o using autofilter?
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-25-2006, 12:45 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