+ Reply to Thread
Results 1 to 4 of 4

Efficient way to Hide all rows with a 0 in a column every time a cell value is changed

Hybrid View

  1. #1
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Efficient way to Hide all rows with a 0 in a column every time a cell value is changed

    Hi Sky,

    Here's a block "hide" that might work for you:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim i As Long, j As Long
    If Target.Address = "$A$1" Then
            Range("A2:A60").EntireRow.Hidden = True
            Select Case Target.Text
                Case "Red":         Range("A2:A20").EntireRow.Hidden = False
                Case "Green":       Range("A21:A40").EntireRow.Hidden = False
                Case "Bue":         Range("A41:A60").EntireRow.Hidden = False
                For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
                If Range("A" & i) = 0 Then
                Do Until Range("A" & j + 1) <> 0: j = j + 1: Loop
                Range("A" & i & ":A" & j).EntireRow.Hidden = True
                End If: Next i
                
        End Select
        End If
    End Sub
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  2. #2
    Forum Contributor
    Join Date
    02-14-2011
    Location
    West Valley City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Efficient way to Hide all rows with a 0 in a column every time a cell value is changed

    Worked wonderfully, Thanks!

+ 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