View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default SPOT THE MISTAKE!....

Yep. I omitted it so you could...

SPOT THE MISTAKE!

(Or maybe I just forgot to add it when I was composing the message <bg.)

Glad you got it working even with the error.

moon wrote:

Correct, only one thing I guess - Set myFoundCell = .... instead of just
myFoundCell = .... because Range is an object.

"Dave Peterson" schreef in bericht
...
Stop using the "on error resume next" stuff.

Instead set a range variable to that found cell, then check to see if that
range
variable is nothing (not found).

Dim myFoundCell As Range
For i = 2 To x
myFoundCell = Sheets("Static").Range("MG_Tournaments").Find _
(What:=Sheets("Input").Cells(i, 7), LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, _
SearchFormat:=False)

if myfoundcell is nothing then
cells(i,8).value = True
else
cells(i,8).value = false
end if
next i

ps.

I think it's more difficult to read when you post in all caps.



WhytheQ wrote:

CAN ANYONE SEE WHERE THE ERROR IS WITH THE FOLLOWING CODE. I REGULARLY
HAVE PROBLEMS WITH THE FIND METHOD. MAYBE I'M MISSING AN ARGUMENT OUT,
AS IT ALWAYS THROWS THE ERROR "OBJECT REQUIRED" EVEN WHEN THE
SERCHSTRING IS IN THE AREA BEING SEARCHED

MAYBE THE PROBLEM IS THAT THE SEARCH STRINGS AND SEARCHAREA ARE ON
DIFFERENT WORKSHEETS?

ANY HELP GREATLY APPRECIATED,
JASON.

Dim myFoundAddress As String
For i = 2 To x
On Error Resume Next
myFoundAddress =
Sheets("Static").Range("MG_Tournaments").Find _
(What:=Sheets("Input").Cells(i, 7), LookIn:=xlValues,
LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=True, _
SearchFormat:=False).Address

If myFoundAddress < "" Then
Cells(i, 8) = "True"
Else
Cells(i, 8) = "False"
End If
Next
On Error GoTo 0


--

Dave Peterson


--

Dave Peterson