Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bernie:
Thank you, I replaced that with the following code: SrcEntRng.AutoFilter Field:=1, Criteria1:="=TributeCardRecipient", Operator:=xlOr, _ Criteria2:="=Tribute" Set Rng2 = SrcRng.Columns(1).SpecialCells(xlVisible).EntireRo w Rng2.Delete SrcWS.AutoFilterMode = False More efficient than going through each idividual row, and I should have thought of it before. S On Aug 19, 12:43*pm, "Bernie Deitrick" <deitbe @ consumer dot org wrote: You have a Do Loop without a way out. *What do you want to do? Find all instances of the values, or just the first? HTH, Bernie MS Excel MVP wrote in message ... The following code bogs down at the "If Not FoundCell" statement and I have no idea why. I was trying to make the code more efficient by assigning all rows that I was deleting to Rng and it worked for all other statements but this one. When I break and step into the code, it gives me a 1004 error for the Set Rng = Union step. Any idea how to make this work? * * * * * *RcdType = Array("TributeCardRecipient") ' "Tribute") ', "NotApplicable") * * * * * *For Each Thing In RcdType * * * * * * * *Do * * * * * * * * * *Set FoundCell = SrcRng.Find(What:=Thing) * * * * * * * * * *If Not FoundCell Is Nothing Then * * * * * * * * * * * * * * * *If Rng Is Nothing Then * * * * * * * * * * * * * * * * * *Set Rng = Rows(FoundCell.Row & ":" & FoundCell.Row) * * * * * * * * * * * * * * * *Else: Set Rng = Union(Rng, Rows(FoundCell.Row & ":" _ * * * * * * * * * * * * * * * * * * * *& FoundCell.Row)) * * * * * * * * * * * * * * * *End If * * * * * * * * * *End If * * * * * * * *Loop * * * * * *Next- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro lagging when copying columns to other sheet | Excel Programming | |||
Issue removing leading and lagging spaces | Excel Programming | |||
Do until loop with use of another macro in loop | Excel Programming | |||
how to put a loop in a macro? | New Users to Excel |