+ Reply to Thread
Results 1 to 2 of 2

How to create a macro that deletes every blank row in a spreadshee

  1. #1
    Grd
    Guest

    How to create a macro that deletes every blank row in a spreadshee

    Hi

    I have a 4000 row spreadsheet with approximately 33 columns and I have about
    about 300 intermittent blank lines.

    How can create a macro in the file to automate the process of deleting these
    empty rows which I do manually?

    I don't want to use the autofilter function to deal with this problem. I
    would if possible to do this with a button or shortcut.

    Anyone can help me this.

    Thanks very much in advance
    Janet

  2. #2
    Martin Fishlock
    Guest

    RE: How to create a macro that deletes every blank row in a spreadshee

    Here is a simple little routine that deletes rows, modify it as needed.

    Option Explicit

    Sub DeleteBlankRows()
    ' written by Martin Fishlock [email protected]
    Dim ws As Worksheet
    Dim r As Long
    Set ws = ActiveSheet
    ws.Range("A65536").End(xlUp).Select ' find last row
    r = ActiveCell.Row
    While r > 0 ' work from the bottom up
    If ws.Range("A" & r) = "" Then ws.Rows(r).Delete ' decide on which
    cell to check
    r = r - 1
    Wend
    Set ws = Nothing
    End Sub


    "Grd" wrote:

    > Hi
    >
    > I have a 4000 row spreadsheet with approximately 33 columns and I have about
    > about 300 intermittent blank lines.
    >
    > How can create a macro in the file to automate the process of deleting these
    > empty rows which I do manually?
    >
    > I don't want to use the autofilter function to deal with this problem. I
    > would if possible to do this with a button or shortcut.
    >
    > Anyone can help me this.
    >
    > Thanks very much in advance
    > Janet


+ 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