+ Reply to Thread
Results 1 to 5 of 5

Hiding and Unhiding Entire Columns based on Cell Reference

  1. #1
    Registered User
    Join Date
    06-30-2010
    Location
    Tucson, Arizona
    MS-Off Ver
    Excel 2007
    Posts
    58

    Hiding and Unhiding Entire Columns based on Cell Reference

    Hello All,

    I would like some help on VBA code for hiding certain columns based off of a cell reference. This question has been solved here, but I now want to connect the macro to a button as seen here. The cell to be referenced is in row 3, (in columns B case, B3) and is a conditional IF statement based on another sheet in the workbook. The possible results are 0 and "".

    The First Button Labaled Relevant Data (this is the button I want to be able to click and have it hide coloumns which the third row is equal to 0). This is the one I need help on. I currently have

    Please Login or Register  to view this content.
    '
    The Second button is labaled "Show all Cells". This button Works, and I do not need help with it, but the code is displayed below

    Please Login or Register  to view this content.
    '
    Thank you in advance!
    Last edited by montego; 07-02-2010 at 01:30 PM.

  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

    Re: Hiding and Unhiding Entire Columns based on Cell Reference

    Can you explain in words the circumstances under which you want to hide those columns?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-30-2010
    Location
    Tucson, Arizona
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: Hiding and Unhiding Entire Columns based on Cell Reference

    Certainly,

    I would like to hide the entire column when the third row in said column is 0. For example, clicking the "Show Relevant Data" button would hide any columns in which the third row is 0. So, if B3=0, column B hould be hidden. if C3="", column C would not be hidden and remain visible, etc. etc. until coloumn BA.

    I hope this clarifies my question a little bit. Let me know if I am still not explaining it clearly.

    Thank you!

  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

    Re: Hiding and Unhiding Entire Columns based on Cell Reference

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-30-2010
    Location
    Tucson, Arizona
    MS-Off Ver
    Excel 2007
    Posts
    58

    works

    THANK YOU! I "approved" your response. Let Me know If there is anything else I can do to help you
    Last edited by shg; 07-02-2010 at 01:26 PM. Reason: deleted quote

+ 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