+ Reply to Thread
Results 1 to 9 of 9

Hide columns with macros

  1. #1
    Registered User
    Join Date
    04-18-2008
    Location
    Chicago, IL
    Posts
    47

    Hide columns with macros

    I love this place. The more questions I have answers, the more dependent I become because the more I realize is possible, that I can't do.

    This time, I'm trying to hide columns based on values on certain cell values.

    Here's the macro I'm using...
    Please Login or Register  to view this content.
    I WANT the macro to look at cells and if the cell is empty hide the column...
    If AL155 is empty, hide Column AL
    ...
    If EZ155 is empty, hide Column EZ

    When I run this macro though, it just hides all columns from AL to EZ.

    Do I have to create new macros for each column? or is it possible with a single macro?

    Thanks again guys!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Maybe like this:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    04-18-2008
    Location
    Chicago, IL
    Posts
    47
    shg, I tried the code you suggested, but that didn't appear to do make anything disappear.

    I should mention that the AL155:EZ155 are not simple strings or numbers...
    here's what I have in the cells...

    Please Login or Register  to view this content.
    Some of the cells are "empty" as in they don't display anything because the linked cell is empty.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    A cell with a formula is not empty, asdvender ...

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-18-2008
    Location
    Chicago, IL
    Posts
    47
    Quote Originally Posted by shg View Post
    Please Login or Register  to view this content.
    Thanks, sorry for the confusion earlier. Worked like a charm!

  7. #7
    Registered User
    Join Date
    04-18-2008
    Location
    Chicago, IL
    Posts
    47

    Additional criteria for hiding column

    Hey, one more question...

    Excel is limited 256 columns and I have a few hundred rows, so I can't transpose my data.
    This will require me to move the columns I would have liked to have to the right of the ones I have on the next row...
    Is there a way to hide columns if two cells don't display characters?

    Here's what I have been using...
    Please Login or Register  to view this content.
    So I would like to check BB26:IA26 and BB52:IA52 and if they BOTH yield "", then hide the column.

    My instinct say it's not possible...hopefully it is though!

    Thanks again guys!

  8. #8
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    See if this works for you.

    Please Login or Register  to view this content.
    HTH

    Jason

  9. #9
    Registered User
    Join Date
    04-18-2008
    Location
    Chicago, IL
    Posts
    47
    Quote Originally Posted by jasoncw View Post
    See if this works for you.

    Please Login or Register  to view this content.
    HTH

    Jason
    Worked like a charm...
    Thanks, Jason!

+ 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. chart disappears when I hide columns with values
    By mufan in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 05-11-2011, 12:09 PM
  2. Hide and Unhiding Columns
    By papastyle3 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-23-2008, 11:03 AM
  3. Hide or erase unused rows and columns
    By MaxAlbertsson in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-09-2007, 07:52 AM
  4. Can you hide cells but keep data? Or reverse columns?
    By Ohucan2 in forum Excel General
    Replies: 3
    Last Post: 04-09-2007, 07:58 AM
  5. Row & Column Auto Hide Through Macro
    By Reyan123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2006, 04:55 AM

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