+ Reply to Thread
Results 1 to 10 of 10

Hide columns if all cells are blank or £0.00

  1. #1
    Registered User
    Join Date
    07-19-2011
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Hide columns if all cells are blank or £0.00

    I have a workbook where Sheet2 scrutinises data contained in Sheet1 (Sheet1 changes daily).
    On Sheet2 I wish to keep rows in range H:Y visible if they contain a value greater than £0.00 but hide them if all cells in the column are either blank or £0.00.
    Where cells contain a £ value this value is derived from a SUMIF formula that looks at Sheet1.
    I need code for a macro button to hide columns if these conditions are met, and to unhide them again. I am very new to Excel, macros and vb so need code I can just copy and paste! Can anybody help, please?
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    07-19-2011
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Hide columns if all cells are blank or £0.00

    I should add that in my real data sheet I need to hide columns from H to BX and potentially more, hence why a macro button is needed - i'm not just being too lazy to 'hide columns' manually!

  3. #3
    Registered User
    Join Date
    08-31-2009
    Location
    boarders' paradise
    MS-Off Ver
    Excel 2002
    Posts
    94

    Re: Hide columns if all cells are blank or £0.00

    what about the first 2 search results in this list?
    http://www.google.co.uk/search?q=mac...+columns+excel

    do the macros there help you?

  4. #4
    Registered User
    Join Date
    08-31-2009
    Location
    boarders' paradise
    MS-Off Ver
    Excel 2002
    Posts
    94

    Re: Hide columns if all cells are blank or £0.00

    or what about this?
    "Macro to hide columns with empty cells"
    http://www.excelforum.com/excel-prog...pty-cells.html

  5. #5
    Registered User
    Join Date
    07-19-2011
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Hide columns if all cells are blank or £0.00

    Hi boarders paradise

    I think your second link looks most promising but i'm such a beginner with vb that i don't know how to apply the code to my specific spreadsheet. I've spent 3 days searching various forums for similar threads. So far i have successfully managed to find code that hides my empty ROWS and some more code that unhides them again, but I can't make the column hiding thing work for me (so far I have only managed to hide all the columns and then crash my PC!).

    I need to hide the columns only if they contain all blank and £0.00 values (i.e. any column containing a value of >£0.00 must remain visible).

    Is this possible?

  6. #6
    Registered User
    Join Date
    07-19-2011
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Hide columns if all cells are blank or £0.00

    Deadline looming... can anyone help me please?

  7. #7
    Registered User
    Join Date
    07-18-2011
    Location
    DC, US
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Hide columns if all cells are blank or £0.00

    For hiding any column, do you just want to check any specific row if it is >0 or you want to check the entire column to see if any cell is >0?

  8. #8
    Registered User
    Join Date
    07-19-2011
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Hide columns if all cells are blank or £0.00

    Hi TheShinE

    Thanks for your reply.

    If any cell in the column is greater than £0.00 I want the column to be visible.
    If the column does not contain any cells with a value greater than £0.00 I want the column to be hidden.
    All cells in the range are either blank, £0.00 or greater than £0.00.
    Cells with a £symbol are using a formula to populate based on information contained in Sheet1.

  9. #9
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Hide columns if all cells are blank or £0.00

    Copy and put this code to the sheet-code of sheet2 (by Right click on sheet 2 in sheettab, then click view code in shorcut menu - then paste the code)

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    07-19-2011
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Hide columns if all cells are blank or £0.00

    Hi tigertiger

    Thanks so much for suggesting some code! So from my Excel worksheet i've gone to the Developer tab, the Visual Basic icon and in the VB screen right clicked on Sheet 2 (Sheet2) and pasted. So far so good I think! What do I do now?

+ 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