Results 1 to 9 of 9

Removing empty rows with a macro

Threaded View

  1. #3
    Registered User
    Join Date
    07-23-2009
    Location
    essex
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Removing empty rows with a macro

    Hi Rob,

    Thanks for your help. I found the macro below, but being a novice have not got it to work.

    Directly below is manually what I want to achieve, but I want the auto macro to search for empty rows.
    Thanks,
    Mike


    
    Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 10/10/2009 by mike.diss
    '
    
    '
        Rows("40:104").Select
        Selection.Delete Shift:=xlUp
        Rows("48:58").Select
        Selection.Delete Shift:=xlUp
        Rows("54:66").Select
        Selection.Delete Shift:=xlUp
    End Sub
    =====================

    
    Sub DeleteBlankRows1()
    Range("39:104").Select
    'Deletes the entire row within the selection if the ENTIRE row contains no data.
    
    
    
    'We use Long in case they have over 32,767 rows selected.
    
    Dim i As Long
    
    
    
        'We turn off calculation and screenupdating to speed up the macro.
    
        With Application
    
            .Calculation = xlCalculationManual
    
            .ScreenUpdating = False
    
          
    
        'We work backwards because we are deleting rows.
    
        For i = Selection.Rows.Count To 1 Step -1
    
            If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
    
                Selection.Rows(i).EntireRow.Delete
    
            End If
    
        Next i
    
    
    
            .Calculation = xlCalculationAutomatic
    
            .ScreenUpdating = True
    
        End With
    
    End Sub
    Attached Files Attached Files
    Last edited by Mikie; 10-11-2009 at 04:36 PM.

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