LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Easy Makro for Deleting Rows

In response to my my question with this -what I thought- simple macro I got
two answers, that worked perfectly, but only on one small worksheet. When I
tried to apply them on a bigger sheet with 1800 rows (and changinge the
macro accordingly) neither would work!

(It would also not work for the "original" Range B2:B30, i.e. it did not
delete any rows in that range.)

The macros we

Sub RemoveRow_1() by JE McGimpsey

Dim rCell As Range
Dim rDelete As Range

For Each rCell In Range("B2:B30") (Changed to "B2:B1800")
If rCell.Value = 0 Then
If rDelete Is Nothing Then
Set rDelete = rCell
Else
Set rDelete = Union(rDelete, rCell)
End If
End If
Next rCell

If Not rDelete Is Nothing Then rDelete.EntireRow.Delete

End Sub


and


Sub RemoveRow_2() by Vergel Adriano

Application.ScreenUpdating = False - added by me: correct?

Dim kRow As Long

For kRow = 30 To 2 Step -1 (changed to 1800 To 2)

With ActiveSheet.Cells(kRow, 2) <- is this for Col. B ?
If .Value = 0 Then
.EntireRow.Delete
End If
End With

Next kRow

End Sub

Values were always in Column B, but I guess they could be in any one.




 
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
Easy Question for deleting rows. SITCFanTN New Users to Excel 3 June 5th 06 06:58 PM
this should be easy - filtered rows Cene K Excel Discussion (Misc queries) 4 December 9th 05 06:49 PM
combining rows and deleting easy for u experts bamamike Excel Programming 2 September 20th 05 03:00 AM
deleting userform or VBA modules by makro pat \(belgium\) Excel Programming 2 March 1st 05 03:08 PM
deleting text is easy... but what about this?!!! ian123[_5_] Excel Programming 2 December 7th 03 06:45 PM


All times are GMT +1. The time now is 06:57 PM.

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

About Us

"It's about Microsoft Excel"