Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Help with FindNext 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
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Help with FindNext error

More likely the problem lies in ThisWorks2, but hard to tell since it is not
also posted.


"SLW612" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Help with FindNext error

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!


"JLGWhiz" wrote:

More likely the problem lies in ThisWorks2, but hard to tell since it is not
also posted.


"SLW612" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Help with FindNext error

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...



In article ,
SLW612 wrote:

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

Reply
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
Do loop error while using FindNext command Adam Excel Programming 0 June 29th 06 06:44 PM
Findnext Noemi Excel Discussion (Misc queries) 1 December 12th 05 11:23 AM
FindNext John Keturi Excel Programming 1 October 16th 04 01:56 PM
Run-time Error '1004' Unable to get the findnext property... Tom Ogilvy Excel Programming 0 July 12th 04 04:27 PM
FindNext SJ[_6_] Excel Programming 7 May 21st 04 06:01 AM


All times are GMT +1. The time now is 01:38 AM.

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"