+ Reply to Thread
Results 1 to 2 of 2

Hide any rows with 0 values

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    378

    Hide any rows with 0 values

    Hi,

    I have a code to hide any rows that contain 0 value or blank cells. this code will search the entire column. is there anyway that you could modify it to search at specific range like in column G but range (G53:G35)

    Thanks,

    Dim LRow As Long
    LRow = Cells(Rows.Count, "G").End(xlUp).Row
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    For x = LRow To 1 Step -1
    If Cells(x, "G").Value = "0" Then
    Rows(x).Hidden = True
    End If
    Next
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Hide any rows with 0 values

    Sub Hide_0andBlank()
    Dim ws As Worksheet:    Set ws = Sheets("Sheet1") 'you may need to change this
    Dim myRange As Range, iRange As Range
    
    Set myRange = ws.Range("G35:G53")
    Application.ScreenUpdating = False
    
    'you may want to add a line to unhide all here.  Not sure though.
    
    For Each iRange In myRange
        If iRange.Value = "" Or iRange.Value = "0" Then
            iRange.EntireRow.Hidden = True
        End If
    Next iRange
    Application.ScreenUpdating = True
    
    End Sub

+ 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. Macro to hide rows with zero values
    By vaciaravino in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2012, 05:49 PM
  2. Using VBA to hide rows with zero values
    By anholland in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2012, 07:08 PM
  3. Hide/unhide rows with zero values
    By sujittalukder in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 06-22-2007, 02:54 AM
  4. Can anyone tell me how to hide rows that have 0 values and text.
    By Aussie in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-13-2006, 06:10 AM
  5. Can you create a macro to hide rows with zero values?
    By natrujillo12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-28-2005, 04:05 PM

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