+ Reply to Thread
Results 1 to 9 of 9

Hiding Rows if a Value is Zero

Hybrid View

  1. #1
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Hiding Rows if a Value is Zero

    Hi johnnycanuck, the following code will hide rows with a 0 in them
    Sub RowHider()
        Dim wb As Workbook
        Dim shtCnt As Long, shtCntr As Long
        Dim StrtRng As Variant, EndRng As Variant, FullRng As Variant, cl As Variant
        Set wb = ActiveWorkbook
        shtCnt = wb.Sheets.Count
        For shtCntr = 1 To shtCnt
            With wb.Sheets(shtCntr)
                Set StrtRng = .Range("F2")
                Set EndRng = .Range("F10000").End(xlUp)
                Set FullRng = Range(StrtRng, EndRng)
                For Each cl In FullRng
                    If cl.Value = 0 Then
                        cl.EntireRow.Hidden = True
                    End If
                Next cl
            End With
        Next shtCntr
    End Sub
    As for your other requirements, it seems like a lot of dialog pop-ups, or can be a lot, for the user to decide on. At any rate, that will require a form with options on it, which may take a little while to design, at least for me it will. However, I can do it but I cannot promise you'll get it post-haste!
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  2. #2
    Forum Contributor
    Join Date
    09-06-2011
    Location
    manchester england
    MS-Off Ver
    Office 365
    Posts
    307

    Re: Hiding Rows if a Value is Zero

    Quote Originally Posted by Mordred View Post
    Hi johnnycanuck, the following code will hide rows with a 0 in them[code]Sub RowHider()
    Dim wb As Workbook!
    I have just tried this code and it nearly does what i require, however there are rows at the top and bottom of the work sheet that i don't want removing, is there a way for this to only run a group of rows i select?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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