+ Reply to Thread
Results 1 to 5 of 5

Hide Column if Cell value is null ("")

  1. #1
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Hide Column if Cell value is null ("")

    I need a quick macro I can run to hide the columns if the formula result for cells B1:AA1 is "" (null) instead of text. This runs explicitly on Sheet2.

    Array VBA is still geek to me, so any assistance is appreciated.
    Last edited by JBeaucaire; 12-28-2008 at 05:31 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

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

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Ah, that looked sweet and simple, but isn't working. Here is a sample formula from a cell in that range:

    S1 =iferror(LEFT('Data-Nov07-08'!AJ1,FIND(" ",'Data-Nov07-08'!AJ1)-1),"")

    So, the cell is returning a "" value. Also, the sheet name might weird out, so I was hoping to use Sheets(2) to eliminate that problem.

    I tried:

    Please Login or Register  to view this content.
    The actual sheetname is currently Chart-Nov07-08, but that will most likely vary and I'd like to step off of the actual sheetname.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Well, some more fiddling, and for some reason THIS version started working:

    Please Login or Register  to view this content.
    Thanks so much!

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Sheets(2) is the second sheet in a workbook, counting chart sheets.

    Worksheets(2) is the second worksheet in a workbook.

    Sheet2 is a variable that exists iif there is a sheet with CodeName Sheet2.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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