Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro deletes row in range, macro then skips the row moved up | Excel Discussion (Misc queries) | |||
Save using Macro but test to see if an error appears on spreadshee | Excel Discussion (Misc queries) | |||
How to create a macro that deletes every blank row in a spread | Excel Programming | |||
How to create a macro that deletes every blank row in a spreadshee | Excel Programming | |||
WHEN DOWNLOADING A TEXTFILE EXCEL DELETES BLANK ROWS - STOP THIS? | Excel Worksheet Functions |