Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

Help with FindNext error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SLW612 - 10 Dec 2007 14:58 GMT
Hello, I have the following code in my workbook and it used to work fine
(from what I remember from working on it last week), but now I am getting an
error message that says "Unable to get the FindNext property of the Range
class" - I have a feeling it has something to do with the asterisk, but I'm
not entirely positive.  Could someone please help me out? Thank you in
advance!

Sub RunMeFirst()
   Dim rngFound As Range
   Dim rngToSearch As Range
   Dim strFirstAddress As String
       Dim wks As Worksheet
   
   Set wks = ActiveSheet
   
   With wks
   
   Set rngToSearch = Sheets("Sheet1").Columns("K:T")
   Set rngFound = rngToSearch.Find(What:="Account Category:*", _
                                   LookAt:=xlWhole, _
                                   LookIn:=xlValues, _
                                   MatchCase:=False)
   If rngFound Is Nothing Then
       MsgBox "Not Found"
   Else
       strFirstAddress = rngFound.Address
       
       Do
           rngFound.Select
               Call ThisWorks2
'>>>This next line is where the debug points:
           Set rngFound = rngToSearch.FindNext(rngFound)
       Loop Until strFirstAddress = rngFound.Address
   End If
End With

End Sub
JLGWhiz - 10 Dec 2007 15:47 GMT
More likely the problem lies in ThisWorks2, but hard to tell since it is not
also posted.

> Hello, I have the following code in my workbook and it used to work fine
> (from what I remember from working on it last week), but now I am getting an
[quoted text clipped - 33 lines]
>
> End Sub
SLW612 - 10 Dec 2007 15:55 GMT
Ah, thank you! That was indeed the problem, another macro I had called out
within ThisWorks2 - just had it called out in the wrong place.

Thanks JLG!

> More likely the problem lies in ThisWorks2, but hard to tell since it is not
> also posted.
[quoted text clipped - 36 lines]
> >
> > End Sub
JE McGimpsey - 10 Dec 2007 16:00 GMT
This works fine for me (with a dummy ThisWorks2). Any reason you have to
select rngFound rather than use the range object directly?

Certainly if ThisWorks2 dereferences rngFound (e.g., deletes the row),
then .FindNext(rngFound) will error...

> Hello, I have the following code in my workbook and it used to work fine
> (from what I remember from working on it last week), but now I am getting an
[quoted text clipped - 33 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.