#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 44
Default simple row deletion

simple request:

after using the auto filter tool, the rows that got sorted out have a height
= 0. I just want a program to delete rows in which the height is 0. or is
there sia way to set up the auto filter to do this, even better.

Sub row_delete()

For i = 1 To 1000

If Rows(i).RowHeight = 0 Then Rows("i").Delete Shift:=xlUp

Next i

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default simple row deletion

Two things. You have to do it backwards or consecutive rows of zero height
won't be deleted and the quotes aren't required:-

Sub row_delete()

For i = 1000 To 1 Step -1
If Rows(i).RowHeight = 0 Then Rows(i).Delete
Next i

End Sub

Mike


"lawson" wrote:

simple request:

after using the auto filter tool, the rows that got sorted out have a height
= 0. I just want a program to delete rows in which the height is 0. or is
there sia way to set up the auto filter to do this, even better.

Sub row_delete()

For i = 1 To 1000

If Rows(i).RowHeight = 0 Then Rows("i").Delete Shift:=xlUp

Next i

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 373
Default simple row deletion

Try going up instead of down. James

Sub RowsOut()
Dim k As Long
For k = 1000 To 1 Step -1
If Rows(k).EntireRow.RowHeight = 0 Then Rows(k).EntireRow.Delete
Next k
End Sub

"lawson" wrote in message
...
simple request:

after using the auto filter tool, the rows that got sorted out have a
height
= 0. I just want a program to delete rows in which the height is 0. or is
there sia way to set up the auto filter to do this, even better.

Sub row_delete()

For i = 1 To 1000

If Rows(i).RowHeight = 0 Then Rows("i").Delete Shift:=xlUp

Next i

End Sub




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,718
Default simple row deletion

It's probably a little faster to do just one delete:

Sub DelZeroHeightRowsAfterAutoFilter()
Dim Cell As Range
Dim DelRows As Range
For Each Cell In Range("_FilterDatabase").Columns(1).Cells
If Cell.RowHeight = 0 Then
If DelRows Is Nothing Then
Set DelRows = Cell
Else
Set DelRows = Union(DelRows, Cell)
End If
End If
Next
If Not DelRows Is Nothing Then DelRows.EntireRow.Delete
End Sub


--
Jim
"lawson" wrote in message
...
| simple request:
|
| after using the auto filter tool, the rows that got sorted out have a
height
| = 0. I just want a program to delete rows in which the height is 0. or is
| there sia way to set up the auto filter to do this, even better.
|
| Sub row_delete()
|
| For i = 1 To 1000
|
| If Rows(i).RowHeight = 0 Then Rows("i").Delete Shift:=xlUp
|
| Next i
|
| End Sub
|
|


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
simple deletion won't work for me jgriffs Excel Discussion (Misc queries) 2 January 29th 06 09:55 PM
On deletion of rows Stephen Howe Excel Discussion (Misc queries) 2 October 7th 05 06:02 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
Make it more simple or intuitive to do simple things Vernie Charts and Charting in Excel 1 March 16th 05 04:01 AM


All times are GMT +1. The time now is 09:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"