+ Reply to Thread
Results 1 to 8 of 8

How to hide columns whose cell do not match a specific value

  1. #1
    Registered User
    Join Date
    06-30-2015
    Location
    London
    MS-Off Ver
    Mac, Excel 2010
    Posts
    3

    Angry How to hide columns whose cell do not match a specific value

    Dear All

    Is there a way to hide a column if there isn't a specific value?
    Let's say I have the following data on my spreadsheet

    A1 = H012
    B1 = 20 Jun
    B2 = H012
    B3 = H011
    C1 = 21 Jun
    C2 = H011
    C3 = H011
    D1 = 22 Jun
    D2 = H012
    D3 = D011

    I would like to hide all the columns that do not have the value I specify in cell A1.

    I would need this to work throughout the whole spreadsheet if possible as I will be adding numerous columns).

    Thank you so much for your help!

    Marco
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to hide columns whose cell do not match a specific value

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,849

    Re: How to hide columns whose cell do not match a specific value

    Another approach:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to hide columns whose cell do not match a specific value

    This will need to be a macro

    How do you intend to trigger the macro?

    The Macro itself will be quite simple to write.

    Mumps's solution is similar to what I would do.

    But Mumps forgot to invert the selection.


    Ok this is your code, right click on the sheet name at the bottom of excel and select view code to edit it.:-

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 06-30-2015 at 01:11 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  5. #5
    Registered User
    Join Date
    06-30-2015
    Location
    London
    MS-Off Ver
    Mac, Excel 2010
    Posts
    3

    Re: How to hide columns whose cell do not match a specific value

    Thank you so much guys. I would like to trigger the macro every time there is a value that is different than "" in A1.
    In an ideal world I would also like to hide all the rows where the value in A1 is not present.

    And also, I would like to unhide all the columns and rows if A1 is "".

    I am really sorry if I sound daft, I am completely new to this!

    Thank you!

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to hide columns whose cell do not match a specific value

    You start out wanting to hide Columns, and end up saying Rows?

  7. #7
    Registered User
    Join Date
    06-30-2015
    Location
    London
    MS-Off Ver
    Mac, Excel 2010
    Posts
    3

    Re: How to hide columns whose cell do not match a specific value

    Thank you John. Yes I then realised I needed to hide both, but I got to the bottom of it thanks to a forum user!

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to hide columns whose cell do not match a specific value

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. hide columns if a cell has a specific word
    By tlacloche in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-17-2014, 08:06 PM
  2. [SOLVED] Hide columns based on specific cell value
    By samcdavies in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2013, 05:53 AM
  3. Hide/Unhide Columns Depending on a specific cell value
    By DaveM13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-19-2012, 06:01 PM
  4. Hide specific columns dependant on number in specific cell
    By ladbroke in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2012, 04:46 PM
  5. Hide columns with 0 in a specific cell
    By Poldark in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2012, 05:27 AM

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