+ Reply to Thread
Results 1 to 4 of 4

macro to hide rows in spread sheets that have zero in all columns

Hybrid View

  1. #1
    Registered User
    Join Date
    11-08-2013
    Location
    co
    MS-Off Ver
    Excel 2010
    Posts
    2

    macro to hide rows in spread sheets that have zero in all columns

    hi i am trying to see if there is a macro that can hide rows in spread sheets that have zero in all columns? for each tab in an excel workbook

    anyone have a macro for this?

  2. #2
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: macro to hide rows in spread sheets that have zero in all columns

    Try this
    Sub HideBlankRows()
    Dim Last As Long
    Dim Rng, c As Range
    Last = Cells(Rows.Count, "A").End(xlUp).Row
    Set Rng = Range("A2:XFD" & Last)
    Application.ScreenUpdating = False
    For Each c In Rng
    If c.Value = "0" Then
    c.EntireRow.Hidden = True
    End If
    Next c
    Application.ScreenUpdating = True
    End Sub
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  3. #3
    Registered User
    Join Date
    11-08-2013
    Location
    co
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: macro to hide rows in spread sheets that have zero in all columns

    i tried this but if gives me a break in code erro on the If c.Value = "0" Then line

    Quote Originally Posted by marreco View Post
    Try this
    Sub HideBlankRows()
    Dim Last As Long
    Dim Rng, c As Range
    Last = Cells(Rows.Count, "A").End(xlUp).Row
    Set Rng = Range("A2:XFD" & Last)
    Application.ScreenUpdating = False
    For Each c In Rng
    If c.Value = "0" Then
    c.EntireRow.Hidden = True
    End If
    Next c
    Application.ScreenUpdating = True
    End Sub

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: macro to hide rows in spread sheets that have zero in all columns

    Please attach a sample and desired output. Before and after the code sheets.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to hide sheets & columns w/same Macro?
    By jgomez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2013, 02:40 PM
  2. Hide columns if rows empty
    By melewis212 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-25-2012, 06:55 PM
  3. Hide Columns / Rows in various sheets on a change in a cell value
    By blankus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-06-2010, 05:43 PM
  4. [SOLVED] Macro to hide/show rows and columns
    By Leo in forum Excel General
    Replies: 4
    Last Post: 05-23-2006, 12:30 PM
  5. Replies: 1
    Last Post: 01-23-2006, 11:10 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