Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default type mismatch on find function


I am getting a type mismatch on this

Dim intResult As Integer
intResult = Range("a:a").Find(What:="abc", After:="A44", LookIn:=xlValues,_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,_
MatchCase:=False, SearchFormat:=False).Row

I have also tried
intResult = Cells.Find(What:="abc", After:="A44", ...).Row
intResult = Selection.Find(What:="abc", After:="A44", ...).Row


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default type mismatch on find function


Dim rResult As Range
SET rResult = Range("a:a").Find( etc etc

"Scooter" wrote in message
...
I am getting a type mismatch on this

Dim intResult As Integer
intResult = Range("a:a").Find(What:="abc", After:="A44",
LookIn:=xlValues,_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,_
MatchCase:=False, SearchFormat:=False).Row

I have also tried
intResult = Cells.Find(What:="abc", After:="A44", ...).Row
intResult = Selection.Find(What:="abc", After:="A44", ...).Row


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default type mismatch on find function


I get a "compile error: type mismatch" with your suggestion. If I take the
".row" off the end of the Find, I still get the "run time error 13: type
mismatch"

"Patrick Molloy" wrote:

Dim rResult As Range
SET rResult = Range("a:a").Find( etc etc

"Scooter" wrote in message
...
I am getting a type mismatch on this

Dim intResult As Integer
intResult = Range("a:a").Find(What:="abc", After:="A44",
LookIn:=xlValues,_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,_
MatchCase:=False, SearchFormat:=False).Row

I have also tried
intResult = Cells.Find(What:="abc", After:="A44", ...).Row
intResult = Selection.Find(What:="abc", After:="A44", ...).Row



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default type mismatch on find function


The "After" argument needs to be an actual Range value, not a String value.
Use this for it...

After:=Range("A44")

--
Rick (MVP - Excel)


"Scooter" wrote in message
...
I am getting a type mismatch on this

Dim intResult As Integer
intResult = Range("a:a").Find(What:="abc", After:="A44",
LookIn:=xlValues,_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,_
MatchCase:=False, SearchFormat:=False).Row

I have also tried
intResult = Cells.Find(What:="abc", After:="A44", ...).Row
intResult = Selection.Find(What:="abc", After:="A44", ...).Row



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default type mismatch on find function


Dim rResult As Range
SET rResult = Range("a:a").Find(What:="abc", After:=Range("A44")



"Patrick Molloy" wrote in message
...
Dim rResult As Range
SET rResult = Range("a:a").Find( etc etc

"Scooter" wrote in message
...
I am getting a type mismatch on this

Dim intResult As Integer
intResult = Range("a:a").Find(What:="abc", After:="A44",
LookIn:=xlValues,_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,_
MatchCase:=False, SearchFormat:=False).Row

I have also tried
intResult = Cells.Find(What:="abc", After:="A44", ...).Row
intResult = Selection.Find(What:="abc", After:="A44", ...).Row




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default type mismatch on find function


There is no need for the OP to do this given what the statement does. Look
at the .Row property call at the end of his Find function call... he is
picking off the Row from the cell that was found by the Find function. Of
course, doing it this way will require the OP to have some error checking
routine to trap the error that will be generated if the text he is searching
for doesn't appear anywhere in Column A (the range he is searching).

--
Rick (MVP - Excel)


"Patrick Molloy" wrote in message
...
Dim rResult As Range
SET rResult = Range("a:a").Find( etc etc

"Scooter" wrote in message
...
I am getting a type mismatch on this

Dim intResult As Integer
intResult = Range("a:a").Find(What:="abc", After:="A44",
LookIn:=xlValues,_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,_
MatchCase:=False, SearchFormat:=False).Row

I have also tried
intResult = Cells.Find(What:="abc", After:="A44", ...).Row
intResult = Selection.Find(What:="abc", After:="A44", ...).Row



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default type mismatch on find function


i missed off the last closed bracket

SET rResult = Range("a:a").Find(What:="abc", After:=Range("A44") )

FIND returns a range object, hence the DIM as Range and we sue SET to assign
the found object to it.



"Patrick Molloy" wrote in message
...
Dim rResult As Range
SET rResult = Range("a:a").Find(What:="abc", After:=Range("A44") )



"Patrick Molloy" wrote in message
...
Dim rResult As Range
SET rResult = Range("a:a").Find( etc etc

"Scooter" wrote in message
...
I am getting a type mismatch on this

Dim intResult As Integer
intResult = Range("a:a").Find(What:="abc", After:="A44",
LookIn:=xlValues,_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,_
MatchCase:=False, SearchFormat:=False).Row

I have also tried
intResult = Cells.Find(What:="abc", After:="A44", ...).Row
intResult = Selection.Find(What:="abc", After:="A44", ...).Row


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default type mismatch on find function


That did the trick. Thanks much.

"Rick Rothstein" wrote:

The "After" argument needs to be an actual Range value, not a String value.
Use this for it...

After:=Range("A44")

--
Rick (MVP - Excel)


"Scooter" wrote in message
...
I am getting a type mismatch on this

Dim intResult As Integer
intResult = Range("a:a").Find(What:="abc", After:="A44",
LookIn:=xlValues,_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext,_
MatchCase:=False, SearchFormat:=False).Row

I have also tried
intResult = Cells.Find(What:="abc", After:="A44", ...).Row
intResult = Selection.Find(What:="abc", After:="A44", ...).Row




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
Type mismatch error in Find method JLGWhiz Excel Programming 1 April 9th 07 03:51 AM
FIND type mismatch error, but don't see it KathyC Excel Worksheet Functions 7 November 14th 06 03:59 PM
Type mismatch error on Find [email protected] Excel Programming 4 November 3rd 06 01:39 AM
Type Mismatch - Match function T De Villiers[_81_] Excel Programming 1 July 31st 06 03:45 PM
Type mismatch in look up function bisjom Excel Programming 6 February 9th 06 05:16 AM


All times are GMT +1. The time now is 02:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"