In the code you posted, you declared PHDResult as a variant with a line like:
Dim PHDResult
If you're going to use application.vlookup() (not
application.worksheetfunction.vlookup()), then you'll want to make sure
PHDResult is a variant (not string, not long...)
Then you can test the results of the =vlookup() with:
phdresult = application.vlookup(...)
if iserror(phdresult) then
msgbox "it wasn't found" 'same as #n/a error
else
msgbox phdresult
end if
===
Can you get the formula to work if you put it in a cell in a worksheet?
If you cannot, you may want to look at Debra Dalgleish's site:
http://contextures.com/xlFunctions02.html#Trouble
Maybe your values aren't what you think they are.
Tommy wrote:
I have changed my code accordingly but I still have a type mismatch
(Runtime Error '13'), which comes on this line:
PHDResult = Application.VLookup(CellValuePHD, Range(Cells(4, 1),
Cells(4, 15).End(xlDown)), 0)
Note that i declared PHDResult as a string.
--
Dave Peterson