+ Reply to Thread
Results 1 to 3 of 3

Hide Rows based on multiple criterias

  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Hide Rows based on multiple criterias

    Hi Excel Experts,

    I found this cool simple macro that helps me to create an action button which will hide/unhide the rows set in the macro accordingly. However, what I want to achieve is not based on row number, but also based on the value/criteria in a cell.

    Macro :
    Sub rowExpanded()
    Rows("7:10").Select
    Selection.EntireRow.Hidden = IIf(Selection.EntireRow.Hidden, False, True)

    End Sub



    Here's the scenario.

    I have rows of data which consists of columns as below:-

    Col A Col B Col C
    Month Dept Details
    Jun POS abcdefg
    Jul HR tytytyty
    Jan IT info1
    Jan POS info123
    Jun HR inform5567
    Jan POS moreinf1111
    Jan POS sdgreyt
    Jan POS ghfghfgh
    Jun IT erohfkzjfk

    Cell D1 = Jan
    Cell D2 = POS

    I want the macro to be able to hide/unhide any row based on criterias in col A and B.
    e.g. Hide/Unide rows that is not the month Jan in col A and dept POS. Result should be those rows which are not Jan and non-POS dept shall be collapsed:-

    Col A Col B Col C
    Month Dept Details
    Jan POS info123
    Jan POS moreinf1111
    Jan POS sdgreyt
    Jan POS ghfghfgh

    Is this achievable by macro? Hopefully so. I know there is an option to use filter but I thought to make it much easier for user to just click a button and excel does it all.

    Thank you in advance.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Hide Rows based on multiple criterias

    Pls add code tags around your codes as per forum rules.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: Hide Rows based on multiple criterias

    Added tags as per requested.

+ 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] Trying to hide multiple rows based on a list selectoin...
    By hvitzthum in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2013, 03:10 PM
  2. [SOLVED] Delete rows based on multiple criterias, copy/paste data and formulas
    By BQuek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2013, 01:36 PM
  3. Hide rows based on multiple column values
    By dtanios in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-07-2012, 02:09 PM
  4. Hide Multiple Rows Based upon a variable
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-22-2012, 01:03 PM
  5. Delete rows based on multiple criterias
    By Benson in forum Excel General
    Replies: 8
    Last Post: 11-02-2005, 06:17 PM

Tags for this Thread

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