Home |
Search |
Today's Posts |
#16
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you use worksheetfunction in the vlookup call and there is no match, you'll
get a run time error. Your code would have to look more like this: Dim res as variant on error resume next res = application.worksheetfunction.vlookup(...) if err.number < 0 then 'No match err.clear else 'match end if on error goto 0 By dropping the worksheetfunction, you could just check for a returned error: dim res as variant res = application.vlookup(...) if iserror(res) then 'no match else 'match end if I never saw anything in your posted code that would check for that runtime error. Peter Hesselager wrote: Hi Dave I'm qouting from below Range("AA6") = Online 'FROM 04-02-2008 00:00:00 Opslag = Range("AA7") 'TO 39482,000 Actually the stuff is running now, but to me, it looks as if the VLookUp-value cannot be of Time and Date format, but must be a normal figure. , so therefore this embarrassing method with setting the value into AA6, and setting AA7= AA6, and format AA7 to Number Format. I don't know how to convert this in VB ( and that's the question for now ) I don't in depth understand, why you don't like the .worksheetfunction, but assume, that I could build a better errorhandling this way ?? Hope, you can help me with the variable format. -- Med venlig hilsen Peter Hesselager-Olesen SBS-IT Aps "Dave Peterson" skrev: I don't see anything that's using AA6. I see that you didn't remove the .worksheetfunction. I'd remove it. -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find Function | Excel Discussion (Misc queries) | |||
If find function to not find anything | Excel Programming | |||
Find function in VBA | Excel Programming | |||
Find Function | Excel Worksheet Functions | |||
backwards find function to find character in a string of text | Excel Programming |