Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi -
I'm using the following code in several places. Initially I had simplified things by letting the Rng values pile up before passing the Delete statement. Unfortunately, I realized that the various searches I used occasionally came up with the same row for a different search criteria. When I ran the delete, it deleted all the rows in the range, but if a row appeared several times, it deleted valid rows as well. This was originally a filter, but I thought performing one delete rather than many would be better. Thoughts? Steven Set FoundCell = SrcHdrRng.Find(What:="Event ID") For Each MyCell In Range(FoundCell.Address, Cells(SrcLast, FoundCell.Column).Address) If MyCell.Value = "Tribute" Then If Rng Is Nothing Then Set Rng = Rows(MyCell.Row & ":" & MyCell.Row) Else: Set Rng = Union(Rng, Rows(MyCell.Row & ":" & MyCell.Row)) End If End If Next If Not Rng Is Nothing Then Rng.Delete End If Set Rng = Nothing |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If a value exists in a range | Excel Programming | |||
Check if a named range exists with VBA? | Excel Programming | |||
See if a Range Name exists? | Excel Programming | |||
how to tell if a named range exists | Excel Programming | |||
Checking to see if a Range Object exists? | Excel Programming |