LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default FIND function i VB

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
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
Find Function SJT Excel Discussion (Misc queries) 5 June 5th 10 11:21 PM
If find function to not find anything Carlos Excel Programming 4 February 14th 08 09:25 AM
Find function in VBA Garage2k Excel Programming 3 August 12th 05 12:01 PM
Find Function Steve Excel Worksheet Functions 2 May 11th 05 07:56 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM


All times are GMT +1. The time now is 07:36 AM.

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

About Us

"It's about Microsoft Excel"