Thread
:
Blank Rows
View Single Post
#
2
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben
external usenet poster
Posts: 22,906
Blank Rows
Try this macro which will delete any row that is completely blank.
Sub DeleteEmptyRows()
'only if entire row is blank
LastRow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then
Rows(r).Delete
End If
Next r
End Sub
If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".
http://www.mvps.org/dmcritchie/excel/getstarted.htm
In the meantime..........
First...create a backup copy of your original workbook.
To create a General Module, hit ALT + F11 to open the Visual Basic Editor.
Hit CRTL + r to open Project Explorer.
Find your workbook/project and select it.
Right-click and InsertModule. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.
Run or edit the macro by going to ToolMacroMacros.
You can also assign this macro to a button or a shortcut key combo.
Gord Dibben MS Excel MVP
On 15 Mar 2007 12:09:40 -0700,
wrote:
I was reading about deleting blank rows but they aren't really
addressing the problem that I am having.
I pull info from an outside program and insert it into an excel sheet
to reformat it. What I need to do more efficiently is get rid of the
blank rows across the columns, BUT not delete rows that have an info
in them. For Instance...
Columns A through G have info on the first row.
Columns D through G have info on the second and third row
Column G has info in the 4th.
Between the three rows there are blank rows that I don't need and the
other thing is I have about 17 pages of the same dilemma so it isn't
just one set and one other thing is I run this report every other week
or so and I have another that I am running weekly that can range from
5 pages to the most recent one which was 32. There are no calculations
anywhere in the spreadsheet so deleting rows shouldn't be a problem.
I am new in this position and have no one to ask about this type of
problem. If I can cut this process time down it would be very
impressive and make my life easier.
Thanks!!!
Reply With Quote
Gord Dibben
View Public Profile
Find all posts by Gord Dibben