+ Reply to Thread
Results 1 to 11 of 11

Hide columns based on value

  1. #1
    Registered User
    Join Date
    12-30-2012
    Location
    NL
    MS-Off Ver
    Excel 2010
    Posts
    17

    Hide columns based on value

    Why can't I get this to work?

    Just want to automatically hide each column (from E to W) that has a capital X in row 3....

    Please Login or Register  to view this content.

  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: Hide columns based on value

    You have your loops off

    Please Login or Register  to view this content.

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

    Re: Hide columns based on value

    You're welcome.

  4. #4
    Registered User
    Join Date
    12-30-2012
    Location
    NL
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Hide columns based on value

    Ooops. Thanks John...
    Nonetheless it's still not working. Seems that all events are not working..?!?

    Tried Application.EnableEvents but doesnt make any difference...

    Please Login or Register  to view this content.

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

    Re: Hide columns based on value

    It worked when I tested it. Do you have a sample you can provide. It triggers when a cell in row 3 is selected.

  6. #6
    Registered User
    Join Date
    12-30-2012
    Location
    NL
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Hide columns based on value

    John, I have attached the file with the sample code
    Attached Files Attached Files

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

    Re: Hide columns based on value

    Maybe I don't understand, but it works on your sample as well. Perhaps you want to trigger it when you put data in row 4 instead?

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-30-2012
    Location
    NL
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Hide columns based on value

    Well, yes

    So then I may need to use Calculate, like this:

    Please Login or Register  to view this content.
    But it doesnt work either...

    Basically, what my intention is: The column containing an "X" is the result of a formula based on things happening on another sheet.
    So when that changes, the column header in row 3 turns into "X" and the column will be hidden.
    Last edited by LeonvL; 10-18-2013 at 02:50 PM.

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

    Re: Hide columns based on value

    The formula you have in row 3 in your sample gets the "X" from input into row 4. Do you want just the activecolumn hidden or all columns hidden based on the input?

  10. #10
    Registered User
    Join Date
    12-30-2012
    Location
    NL
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Hide columns based on value

    I have simplified it a bit in the sample sheet.
    When the value in a certain column in row 3 changes I want only that certain column to be hidden.

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

    Re: Hide columns based on value

    Maybe:

    Please Login or Register  to view this content.

+ 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 Columns based on level of access e.g. if "Read Only" Hide G:G
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-16-2013, 06:10 AM
  2. Need to hide columns based on no or 0 value
    By freakycali in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 04-29-2013, 06:20 AM
  3. Hide columns based on value
    By arip in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-07-2011, 05:28 PM
  4. how to hide rows based on the value of two columns
    By salventuro in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-19-2009, 07:29 PM
  5. [SOLVED] Hide Columns Based on Condition
    By Skornia115 in forum Excel General
    Replies: 3
    Last Post: 07-05-2006, 06:35 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