Results 1 to 2 of 2

Toggle Hide Row Based on Column Data

Threaded View

thesonofdarwin Toggle Hide Row Based on... 03-11-2013, 07:28 PM
thesonofdarwin Re: Toggle Hide Row Based on... 03-12-2013, 06:57 PM
  1. #1
    Registered User
    Join Date
    10-13-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    75

    Toggle Hide Row Based on Column Data

    I'm looking to have a macro that will hide all rows where the cell in column B of that row is blank. The formulas in those cells are returning "" if there isn't a calculated value. I'd like that macro to also unhide all rows if there are currently rows hidden in the range. However, I'm having trouble simply getting the rows to hide. I tried the following:

    Sub ToggleHide()
        If Range("B:B").Value = "" Then
            Rows("2:200").EntireRow.Hidden = True
        Else: Rows("2:200").EntireRow.Hidden = False
        End If
    End Sub
    That didn't work, so I thought "" might be returning as Null and tried the following, which also did not work.

    Sub ToggleHide()
        If IsNull(Range("B:B").Value) Then
            Rows("2:200").EntireRow.Hidden = True
        Else: Rows("2:200").EntireRow.Hidden = False
        End If
    End Sub
    Any suggestions?
    Last edited by thesonofdarwin; 03-11-2013 at 07:38 PM.

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