View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Janelle Janelle is offline
external usenet poster
 
Posts: 17
Default vblookup and type mismatch

You're right about the typos in my post. Sorry about that.
Unfortunately, though, I checked and the typos ONLY appear
in the post - not in the code or the contents of any of
the variables. Which means I still don't know why this
isn't working.

-----Original Message-----
If there's not a match, you could get that error.

You can either ignore it and check later:

on error resume next
intWhichArrayRow = application.worksheetfunction.vlookup

(....)
if err.number < 0 then
'didn't find it, what should happen
err.clear
end if
on error goto 0

Or you could drop the .worksheetfunction and return a

variant:

dim intWhichArrayRow as Variant
intwhicharrayrow = application.vlookup(....)
if iserror(intwhicharrayrow) then
'didn't find it, what should happen
end if

Either way, I'm betting you have a slight spelling

difference between your
vlookup value and column 1 of your vlookup table.

(I didn't see it in your post, though.)
(tongue in check)
But I can't trust your post--you did have a typo in this

line:
varGraphCheckList(8901,3) = "" (Variant/String)
I bet that ",3" should have been ",4"!
(end tongue in cheek)



Janelle wrote:

HELP!!! I've checked everything I can think of, and I
have no idea why this isn't working. Can anyone help

me?
I have a line of code that's giving me a Type Mismatch
error. It reads as follows:

intWhichArrayRow = Application.WorksheetFunction.VLookup
(strWhereGraph & strGraphNum & ".tif",

varGraphCheckList,
2, False)

Using the Locals & Immediate windows, plus the
basic "hover method", I have verified that:

strWhereGraph = "Q:\1COM_ART\MAS\" (this one's a public
variable from another module)
strGraphNum = "TP0001" (String)
varGraphCheckList is a variant array (Variant(1 to

9255, 1
to 4))
varGraphCheckList(8901,1) = "Q:\1COM_ART\MAS\TP0001.tif"
(Variant/String)
varGraphCheckList(8901,2) = 8901 (Variant/Integer)
varGraphCheckList(8901,3) = 0 (Variant/Integer)
varGraphCheckList(8901,3) = "" (Variant/String)
intWhichArrayRow = 0 (Integer)


--

Dave Peterson

.