+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: Remove blank rows

  1. #1
    Registered User
    Join Date
    08-30-2010
    Location
    DC
    MS-Off Ver
    Excel 2003
    Posts
    9

    Remove blank rows

    Hi

    I do not know how to use macro. I am tired to delete the blank rows manually each month.

    Please make my days easier if you know how I can go about remove the blank rows on the attached file. I have used F5 but it is not friendly

    If I have to use macro - can you give me the baby step-by-step and the codes pls

    Thank you all!
    Attached Files Attached Files

  2. #2
    Extremely Helpful member
    Join Date
    12-23-2006
    Location
    Belgium
    MS-Off Ver
    XL2003
    Posts
    6,127

    Re: How to remove blank rows

    Please post in the correct forum in the future. I will move it for you this time.

    Please have a look at our forum rules.
    Quoting entire posts clutters the forum and makes threads hard to read !

    If you are pleased with a member's answer then use the Star icon to rate it

    Click here to see forum rules

  3. #3
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,230

    Re: How to remove blank rows

    Put this code in a normal code module:

    Sub Macro1()
        Cells.AutoFilter
        With ActiveSheet.Range("$A$1:$E$15248")
            .AutoFilter Field:=1, Criteria1:="="
            .AutoFilter Field:=5, Criteria1:="="
            .Offset(1, 0).EntireRow.Delete
        End With
        Cells.AutoFilter
    End Sub

    Regards

  4. #4
    Registered User
    Join Date
    08-30-2010
    Location
    DC
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: How to remove blank rows

    Am so sorry.. I have never used macros before.. how do I go about using the code you provided?

    can I email you the file to help?

  5. #5
    Forum Guru Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    2,782

    Re: How to remove blank rows

    I have placed the macro in your sample file. It is named Macro1

    Here are instructions for running it:

    http://spreadsheets.about.com/od/adv...el_macro_5.htm
    Attached Files Attached Files

  6. #6
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,230

    Re: How to remove blank rows

    @Cutter: thanks

  7. #7
    Forum Guru Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    2,782

    Smile Re: How to remove blank rows

    You're welcome. I did it because your green light was out.

  8. #8
    Forum Contributor
    Join Date
    10-06-2008
    Location
    Canada
    Posts
    141

    Re: How to remove blank rows

    I would replace

    With ActiveSheet.Range("$A$1:$E$15248")
    with

    With ActiveSheet.Range("$A$1", Range("A" & Rows.Count).End(xlUp).Offset(, 4))
    Also, add Application.ScreenUpdating = False at the beginning of the code and Application.ScreenUpdating = True at the end.

    The code would look like this

    Sub Macro1()
    Application.ScreenUpdating = False
        Cells.AutoFilter
        With ActiveSheet.Range("$A$1", Range("A" & Rows.Count).End(xlUp).Offset(, 4))
            .AutoFilter Field:=1, Criteria1:="="
            .AutoFilter Field:=5, Criteria1:="="
            .Offset(1, 0).EntireRow.Delete
        End With
        Cells.AutoFilter
        Application.ScreenUpdating = True
    End Sub
    Not nitpicking, just observing.

    John

  9. #9
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,230

    Re: Remove blank rows

    @jolivanes: fair observation ... perhaps being just a little bit lazy, although I did tidy up the recorded macro

  10. #10
    Forum Contributor
    Join Date
    10-06-2008
    Location
    Canada
    Posts
    141

    Re: Remove blank rows

    Might be that "lazy" is the wrong word.
    You could be busy and I have time on hand.

  11. #11
    Registered User
    Join Date
    08-30-2010
    Location
    DC
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Remove blank rows

    Hi

    Thank you for all the help. I am still stuck

    I do get the following error message

    RUN-TIME ERROR '1004'
    AUTOFILTER METHOD OF RANGE CLASS FAILED

    Can I email the file am working on to someone who can help.. please

  12. #12
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,230

    Re: Remove blank rows

    Is the worksheet protected?

    How different is the real file from the sample you have posted?

    Regards

  13. #13
    Registered User
    Join Date
    08-30-2010
    Location
    DC
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Remove blank rows

    no its is not protected

  14. #14
    Forum Contributor
    Join Date
    10-06-2008
    Location
    Canada
    Posts
    141

    Re: Remove blank rows

    Does this attached workbook work on your computer?
    Attached Files Attached Files
    Last edited by jolivanes; 03-07-2011 at 05:09 PM. Reason: fix spelling

  15. #15
    Registered User
    Join Date
    08-30-2010
    Location
    DC
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Remove blank rows

    I am about to give up... i try to attach the whole file but the MB on myfile wont allow me

    if one can help pls.. let me email u

+ 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.2.0