Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Function Add-in troubleshooting-Vlookup

I use Vlookup extensively and attempted to add a new function, Vlook.

The function should 1) set the 4th argument to false, and 2) return an empty
string if the regular formula would return an error.

#2 is what I'm having a problem with.

Here's my code

Function vlook(cell,range,column)
vlook = Application.WorksheetFunction.vlookup(cell,range,c olumn,FALSE)
if Application.WorksheetFunction.IsError(vlook) then vlook = ""
End Function


The code works for non-errors, however, returns #VALUE! instead of "" if the
formula cannot be resolved.

Help!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Function Add-in troubleshooting-Vlookup

Sorry, I mistyped a line of code, my code is as follows:

Function vlook(cell,range,column)
vlook = Application.WorksheetFunction.vlookup(cell,range,c olumn,FALSE)
if Application.WorksheetFunction.IsError(vlook) = TRUE then vlook = ""
End Function



"Mike Rediger" wrote in message
news:5UQBb.6442$US3.1042@okepread03...
I use Vlookup extensively and attempted to add a new function, Vlook.

The function should 1) set the 4th argument to false, and 2) return an

empty
string if the regular formula would return an error.

#2 is what I'm having a problem with.

Here's my code

Function vlook(cell,range,column)
vlook = Application.WorksheetFunction.vlookup(cell,range,c olumn,FALSE)
if Application.WorksheetFunction.IsError(vlook) then vlook = ""
End Function


The code works for non-errors, however, returns #VALUE! instead of "" if

the
formula cannot be resolved.

Help!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Function Add-in troubleshooting-Vlookup

Hi Mike,

Mike Rediger wrote:
*
The code works for non-errors, however, returns #VALUE! instead of ""
if the
formula cannot be resolved.

Help! *


Works for non errors? Do you have a line "On Error Resume Next"
somewhere?

Anyway, "Application.WorksheetFunction.VLookup" need error trap to work
for non errors like this.

Please try this code.


Code:
--------------------

Function vlook(cell, range, column)
On Error Resume Next
vlook = Application.WorksheetFunction.VLookup(cell, range, column, False)
If Err.Number < 0 Then vlook = ""
End Function

--------------------



---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Function Add-in troubleshooting-Vlookup

Perfect!

Thanks for your help!

"Colo" wrote in message
...
Hi Mike,

Mike Rediger wrote:
*
The code works for non-errors, however, returns #VALUE! instead of ""
if the
formula cannot be resolved.

Help! *


Works for non errors? Do you have a line "On Error Resume Next"
somewhere?

Anyway, "Application.WorksheetFunction.VLookup" need error trap to work
for non errors like this.

Please try this code.


Code:
--------------------

Function vlook(cell, range, column)
On Error Resume Next
vlook = Application.WorksheetFunction.VLookup(cell, range, column,

False)
If Err.Number < 0 Then vlook = ""
End Function

--------------------



---
Message posted from http://www.ExcelForum.com/



Reply
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
VLookup Troubleshooting #N/A IrishEyes Excel Discussion (Misc queries) 1 January 12th 10 05:56 PM
Troubleshooting David Rogers Excel Discussion (Misc queries) 2 November 26th 08 12:02 PM
Function Troubleshooting Sarah Excel Worksheet Functions 1 June 7th 07 10:28 PM
SUMPRODUCT troubleshooting CathB Excel Worksheet Functions 7 May 10th 06 03:01 PM
troubleshooting Mr. Lucky69 Setting up and Configuration of Excel 0 April 29th 06 08:57 PM


All times are GMT +1. The time now is 12:08 PM.

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

About Us

"It's about Microsoft Excel"