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 cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop That Deletes Blank Rows

Status
Not open for further replies.

popnlok

Computer
Joined
Apr 20, 2004
Messages
2
Location
US
I have a worksheet that contains a table, the entries in the table vary, so I need the table to adjust to the amount of entries in the table, so there isn't blank rows that are formatted with borderlines.

I was thinking something like "If Range is "", then delete..." That sort of logic, or maybe even something better if anyone knows.

Thanks in advance for any help you can give.
Anthony
 
Just loop through the required range (working from the bottom up), check cells for blank and delete row as required:
[tt]
Private Sub CommandButton1_Click()
Dim intRow As Integer
For intRow = 20 To 1 Step -1
With Range("A" & intRow)
If .Value = "" Then
Rows(intRow).Delete Shift:=xlUp
End If
End With
Next intRow
End Sub
[/tt]

That should get you started

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting
 
Your a genius...thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top