Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete blank rows before print

Status
Not open for further replies.

tuxalot

Technical User
Sep 5, 2002
34
US
Trying to hide rows with no values (but contain formulas, conditional formatting) from the bottom up in a three page worksheet prior to printing. During execution, after row is found with data, exit sub.

I have tried this and while it works, it's painfully slow...
With Range("C11:E100")
Set mRange = .Find(What:="", LookIn:=xlValues)
Do While Not mRange Is Nothing
mRange.EntireRow.Hidden = True
Set mRange = .FindNext
Loop
End With

I've tried setting the:
Find(What:="" to...
Find(What:="0" but this didn't work.

Also, this hides all rows, and I only want to hide the rows below the last row containing data.

Thanks again for all your help.
 
If the rows in question are at the bottom, then your code should start checking the cells from the bottom up rather than from the top down.

Try the following (you may need to make some adjustments as I don't know the shape of your data).

ActiveCell.SpecialCells(xlLastCell).Offset(1, 0).Select
ActiveCell.End(xlToLeft).Offset(-1, 2).Select

Do Until ActiveCell.Value <> &quot;&quot;
ActiveCell.EntireRow.Hidden = True
ActiveCell.Offset(-1, 0).Select
Loop
 
Hi GG,

Thanks for your post. I will be trying your suggestion later today. I appreciate your input.

Darin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top