Modifying FindNext and Copy Code
I am trying modify code that Tom Ogilvy provided in a post
on 8/23/04 to basically do the same steps required in
Lolly's original post, except that I want to cut the
entire row out of the first worksheet and paste it into
a second worksheet. My problem is that I'm only getting
one out of the five records I know exist in the
spreadsheet, and I'm sure the issue is between the "Else"
and "Loop" statement. So far, the code looks like this:
Dim rng As Range, rng1 As Range
Application.Worksheets("Pivot Data").Select
Set rng = Range("PivotData").Find(What:="Funky: Ticket
Before Notify", _
LookAt:=xlWhole, LookIn:=xlValues)
If rng Is Nothing Then
MsgBox "Data Not Found"
Exit Sub
Else
Set rng1 = rng
Do While rng1.Offset(1, 0).Value = "Funky: Ticket
Before Notify"
Set rng1 = rng1.Offset(1, 0)
Loop
Range(rng, rng1).EntireRow.Copy _
Destination:=Application.Worksheets("Errors").Rang e
("A2")
End If
I'm pretty sure I'm not giving the loop the correct
instruction, but I don't know how to fix it. The text
string that I'm looking for is in Column V (Column 22).
Any help would be very much appreciated.
Thanks in advance,
Val
|