Results 1 to 10 of 10

Problem with Loop Macro to Hide Rows.

Threaded View

  1. #1
    Registered User
    Join Date
    12-09-2011
    Location
    Kilkenny
    MS-Off Ver
    Excel 2007
    Posts
    5

    Problem with Loop Macro to Hide Rows.

    Hi All,

    I have been trying to create a macro to hide blank rows. However I want leave single blank rows where they appear between groups of data. The single blank rows are already in the data set and the large number I want to hide are at the end of the group of data. I created the macro below and it works leaving the single blank rows however when it reaches the multiple blank rows it only hides every other blank row. Here is the code:

    
    Sub HideRow()
        Dim i As Long
        i = 11
        Do Until Range("B" & i + 1) = "stop"
            If Range("B" & i + 1) = "" And Range("B" & i + 2) = "" Then
                Range("B" & i).EntireRow.Hidden = True
                i = i + 1
            End If
            i = i + 1
        Loop
    
        
    End Sub
    I have tried varying a few parameters to no avail and need some other ideas! Any help would be appreciated!

    Cheers
    James
    Last edited by jt269; 12-09-2011 at 05:11 AM.

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