ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Runtime Error 13 Type Mismatch (https://www.excelbanter.com/excel-programming/382305-runtime-error-13-type-mismatch.html)

Arturo

Runtime Error 13 Type Mismatch
 
Im testing If rngFound Is Nothing.
(A) searches too broadly where Im needing to only look in column A. (B)
generates a type mismatch 13. Every type Ive assigned to rngFound results
in an error Im not resolveing€¦

(A)
Dim rngFound As Range
Set rngFound = Cells.Find(What:=Y_CellBase, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

(B)
Dim rngFound As Range
Set rngFound = Columns("A:A").Find(What:=Y_CellBase, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

Appreciatively,
Arturo

Tom Ogilvy

Runtime Error 13 Type Mismatch
 
I would expect version B to work, but try changing

Columns("A:A") to Columns(1)

--
Regards,
Tom Ogilvy


"Arturo" wrote:

Im testing If rngFound Is Nothing.
(A) searches too broadly where Im needing to only look in column A. (B)
generates a type mismatch 13. Every type Ive assigned to rngFound results
in an error Im not resolveing€¦

(A)
Dim rngFound As Range
Set rngFound = Cells.Find(What:=Y_CellBase, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

(B)
Dim rngFound As Range
Set rngFound = Columns("A:A").Find(What:=Y_CellBase, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

Appreciatively,
Arturo



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com