+ Reply to Thread
Results 1 to 2 of 2

Hide Cells with zero values but blank rows should be ignored

Hybrid View

  1. #1
    Registered User
    Join Date
    10-02-2011
    Location
    Cyprus
    MS-Off Ver
    Excel 2003
    Posts
    1

    Hide Cells with zero values but blank rows should be ignored

    Hi,

    I am trying to hide in two columns the cells with zero values using vba but I like to keep the empty rows.

    Thank you constantinos

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Hide Cells with zero values but blank rows should be ignored

    Hi ckozakos,

    Use the following code:-

    Sub hide()
    i = Cells.SpecialCells(xlCellTypeLastCell).Row
    Range("a1").Select 'change this with your first column
    For a = 1 To i
        If ActiveCell.Value = 0 And ActiveCell.Value <> "" Then
            If ActiveCell.Offset(0, 1).Value = 0 And ActiveCell.Offset(0, 1).Value <> "" Then
            Selection.EntireRow.Hidden = True
            Selection.Offset(1, 0).Select
            End If
        Selection.Offset(1, 0).Select
        Else
        Selection.Offset(1, 0).Select
    End If
    Next
    End Sub
    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

+ 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