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: 118
Default Can't get FindNext after deleting row?

I built a macro step by step to search a worksheet for certain criteria. I
set a range to my search area, then used Find and Find Next to go through
the range and locate the criteria. All worked well - until I came to the
crucial last step: deleting the row with the criteria. When I include the
delete, I get "Unable to get FindNext property of Range class."

I'm thinking I've run afoul of either (a) deleting the row containing my
Range, or (b) because I have deleted a row, I've changed the range set for
my search , and I need to reset it. Either way, I need to get a different
way to do it. Any suggestions are welcome.

Ed

The applicable code is:

' Set search range to 3rd column
Set rngSearch = Range(Cells(1, 3), Cells(Rows.Count, 3).End(xlUp))

' Search each Cell in column
With rngSearch
Set rngFound = .Find("AAA", LookIn:=xlValues)
If rngFound Is Nothing Then
MsgBox "Not here"
Else:
Address = rngFound.Address

Do
thisRow = rngFound.Row
nextRow = thisRow + 1

' **more code**

Range("C" & thisRow).EntireRow.Delete
Set rngFound = .FindNext(rngFound)

' **ERROR ON NEXT LINE**
Loop While Not rngFound Is Nothing And rngFound.Address < Address
End If
End With


 
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
Findnext Noemi Excel Discussion (Misc queries) 1 December 12th 05 11:23 AM
FindNext SJ[_6_] Excel Programming 7 May 21st 04 06:01 AM
findnext issues mark kubicki Excel Programming 3 February 15th 04 03:22 AM
FindNext problem mark kubicki Excel Programming 4 February 14th 04 02:42 AM
problem with .FindNext Bob Cochran Excel Programming 6 October 11th 03 02:02 PM


All times are GMT +1. The time now is 10:36 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"