DELETING BLANK ROWS OR ROWS W/ A SPECIFIC WORD

ESCIV

New Member
Joined
Sep 25, 2002
Messages
11
I have exported data from Quickbooks into Excel which I need to print. Unfortunately the QB report includes a blank line after each record. It also has 2 lines with the word "total" which I don't want. If I can delete the blank rows and each row that contains the "total" I can reduce the report from 300 pages to about 20! But how to?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

ThePencilQueen

Board Regular
Joined
Jun 26, 2002
Messages
109
My, slightly obscure, method is to inster a column, put a one next to the first row (the one with data) and leave the next blank, then a two. I then select the top four cells and autofill down to the bottom, I then sort the entire sheet on this column so that the blank cells get moved to the bottom.
Same goes for getting rid of the "total" rows...just make sure they don't have a number asigned.

Its not pretty but its quicker than "delete row" "delete row" etc etc all day long.
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,257
Here's a macro that will do that, without loops or an extra column. It assumes your "total" word, and blank cells, are in column A (if not, then modify the code for the appropriate column):

Sub DeleteRowsTotal()
Range("A:A").Replace What:="total", Replacement:="", LookAt:=xlWhole
On Error Resume Next
Range("A:A").SpecialCells(xlBlanks).EntireRow.Delete
End Sub
 

Forum statistics

Threads
1,143,704
Messages
5,720,378
Members
422,281
Latest member
jantoooh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top