+ Reply to Thread
Results 1 to 4 of 4

Use a Macro to hide zero value rows across multiple columns.

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2010
    Posts
    4

    Use a Macro to hide zero value rows across multiple columns.

    I'm using the following Macro to hide zero rows over multiple columns and it's working great. I'm wondering what I can do to run this macro if some of the columns are blank, such as D, F, and G?

    Sub HideRowsCtoBY()
    Dim Last, i As Long
    Application.ScreenUpdating = False
    Last = Range("C:BY").Find(What:="*", After:=[C1], SearchDirection:=xlPrevious).Row
    For i = Last To 1 Step -1
    If Application.CountIf(Range("C" & i & ":BY" & i), "0") = 75 Then
    Range("C" & i & ":BY" & i).EntireRow.Hidden = True
    End If
    Next i
    Application.ScreenUpdating = True
    End Sub

    Thanks!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Use a Macro to hide zero value rows across multiple columns.

    Maybe:

    Please Login or Register  to view this content.

    Should cope with all 0, all blank, or a combination


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-17-2013
    Location
    Spokane
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Use a Macro to hide zero value rows across multiple columns.

    Thanks TMS

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Use a Macro to hide zero value rows across multiple columns.

    You're welcome.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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