Results 1 to 14 of 14

Macro to hide all rows with a zero

Threaded View

  1. #1
    Registered User
    Join Date
    10-14-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    25

    Macro to hide all rows with a zero

    Hi all

    I have been trying to find a macro which will hide any rows where the entire range in columns C:M has a value of 0. I have found a macro which comes close but it seems to hide a bit too much.

    If you see the attached sheet you will see I have highlighted some rows in Red these are rows I don't want this macro to hide and rows in Yellow which is does hide and I want it to hide.

    If anyone can help me perfect this macro so it doesn't hide the red rows I would be grateful.DSO Report Latest (version 2) static.xls

    This is the macro.

    Sub Hide_Zero_Rows_All_Sheets()
         
        Dim ws As Worksheet, c As Range
         
        Application.ScreenUpdating = False
        On Error Resume Next
         
        For Each ws In ThisWorkbook.Worksheets
            Select Case ws.Name
            Case "Sheet1", "Sheet2" 'sheets to exclude
                 'do nothing
                 
            Case Else 'hide rows on these sheets
                For Each c In ws.Range("C15:M148")
                    c.EntireRow.Hidden = c.Value = 0
                Next c
            End Select
        Next ws
         
        Application.ScreenUpdating = True
         
    End Sub
    Last edited by CFlack8472; 07-26-2013 at 08:35 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 05-10-2013, 12:04 PM
  2. [SOLVED] Hide rows macro
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-31-2012, 10:25 AM
  3. Using check boxes to hide and un-hide rows with drop down lists within rows
    By Sparky_Chris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2012, 07:22 AM
  4. Macro to Hide and Unhide Rows but still be able to insert rows
    By majasmi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2011, 09:25 PM
  5. macro to hide rows
    By EdMac in forum Excel General
    Replies: 2
    Last Post: 02-02-2007, 08:12 AM

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