+ Reply to Thread
Results 1 to 5 of 5

Hiding and Unhiding Entire Columns based on Cell Reference

Hybrid View

  1. #1
    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!

  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

    Sub CommandButton1_Click()
        Dim cell As Range
        
        For Each cell In Me.Range("B3:BA3").Cells
            If VarType(cell.Value) = vbDouble And cell.Value = 0 Then
                cell.EntireColumn.Hidden = True
            End If
        Next cell
    End Sub
    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

    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