+ Reply to Thread
Results 1 to 13 of 13

hide and unhide columns based on cell value

  1. #1
    Registered User
    Join Date
    11-27-2014
    Location
    Miami, Florida
    MS-Off Ver
    2010
    Posts
    14

    Post hide and unhide columns based on cell value

    I was wondering if somebody can help me with VBA code to automatically hide certain rows based on a cell value. I want to hide columns Q, T and AC if cell E2 shows one of these names: Fantasy, Fascination, Inspiration, Paradise....However, I would like to unhide these columns if user sets E2 cell to show: Breeze, Conquest, Dream, Magic...

    Also, sheet is protected and workbook structure as well

    Thank you
    Last edited by darijokesar; 11-27-2014 at 10:49 PM.

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: hide and unhide columns based on cell value

    Here you go try this


    Please Login or Register  to view this content.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: hide and unhide columns based on cell value

    Oh and Welcome to the forum

  4. #4
    Registered User
    Join Date
    11-27-2014
    Location
    Miami, Florida
    MS-Off Ver
    2010
    Posts
    14

    Re: hide and unhide columns based on cell value

    Thank you for welcome and fast response, much appreciated. I moved your code to sheet module but nothing happens..what am I missing here? It does not give me any code errors but doesn't do the job either.

  5. #5
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: hide and unhide columns based on cell value

    It might be the fact that your sheet is protected. Have you tried up protecting and running. If that works we'll work out how to do this in the macro. If it doesn't work are you able to post your worksheet up?

  6. #6
    Registered User
    Join Date
    11-27-2014
    Location
    Miami, Florida
    MS-Off Ver
    2010
    Posts
    14

    Re: hide and unhide columns based on cell value

    Test.zip

    OK, hope attachment will go through. I have left workbook structure unprotected as well as Day 1 sheet. If you can help me hide last two columns in Day 1 sheet we can work from there. Couple of things...first, E2 cell gets value based on C1 cell in Cover sheet. Second, C2 cell is data validated. If you need password...3655

  7. #7
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: hide and unhide columns based on cell value

    Sorry, Can't open zip file.

  8. #8
    Registered User
    Join Date
    11-27-2014
    Location
    Miami, Florida
    MS-Off Ver
    2010
    Posts
    14

    Re: hide and unhide columns based on cell value

    TestNew.xlsm

    OK, I have removed several sheets to make doc under 1MB...disregard Cover sheet formula errors, we need Day 1 sheet anyways

    Thank you for your time, much appreciated

  9. #9
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: hide and unhide columns based on cell value

    Ok I've got on another computer and have opened your first zip file.

    First issue is on day 1 sheet the value is in C2 not E2 because it looks like you've merged cells.

    But I'm getting a few weird results so bear with me while I work on it

  10. #10
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: hide and unhide columns based on cell value

    Try this

    Delete the last on I sent you and replace with this one in each sheet you want to hide or unhide columns. This will hide column AC at the moment

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    11-27-2014
    Location
    Miami, Florida
    MS-Off Ver
    2010
    Posts
    14

    Re: hide and unhide columns based on cell value

    Well, I tried with C2 as well but no luck. I even tried with CASE statements but still no desired resault

  12. #12
    Registered User
    Join Date
    11-27-2014
    Location
    Miami, Florida
    MS-Off Ver
    2010
    Posts
    14

    Re: hide and unhide columns based on cell value

    ..now looking at you change select command to AC2 it it makes sense...it works like a charm..I cannot thank you enough

  13. #13
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: hide and unhide columns based on cell value

    Whew. Glad it worked

+ 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/Unhide columns based on the value of the cell help!
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-11-2014, 09:03 PM
  2. [SOLVED] Hide/Unhide Columns based on Cell Value
    By dberg in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-26-2013, 03:36 PM
  3. Hide/Unhide columns based on value of a cell
    By redrackham in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-24-2011, 09:14 AM
  4. Hide & Unhide columns based on a cell value
    By DaveNUFC in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-21-2010, 09:40 AM
  5. Hide or Unhide certain columns based on a cell value
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2006, 01:04 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