Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default UDF in module of personal.xls

For a UDF

=Personal.xls!CaseVlook(args)


Gord Dibben MS Excel MVP

On Sun, 5 Jul 2009 02:58:00 -0700, Mike H
wrote:

Hi,

You need to tell Excel it's in Personal.Xls

Application.Run "Personal.xls!CaseVLook............etc

Mike

"Jack Sons" wrote:

Hi all,

When I put a UDF in a module of the workbook in which I want to use the UDF
the result is #NAME?
When I put a UDF in a module of personal.xls I can use it in any other xls,
I thought. But when I do, the result also is #NAME?
Strange enough, UDF's that I put in modules of workbooks or personal.xls
long ago do work flawlessly.

See the most recent example below.

What goes wrong and how to correct it?

TIA

Jack Sons
The Netherlands
---------------------------------------------------------------------------------------------------
'To use the macro, simply call the function with the value you want to find
'(say cell C1), the range whose first column should be searched
'(such as A:B), and optionally the offset of the column within that range,
as he
'=CaseVLook(C1;A:B;2) semicolons because of my European version of Excel
2000.


Function CaseVLook(compare_value, table_array As Range, _
Optional col_index As Integer = 1)
Dim c As Range
Dim rngColumn1 As Range

Application.Volatile

Set rngColumn1 = table_array.Columns(1)
CaseVLook = "Not Found"

'Loop first column
For Each c In rngColumn1.Cells
If c.Value = compare_value Then
CaseVLook = c.Offset(0, col_index - 1).Value
Exit For
End If
Next c
End Function




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
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
code in module A to not execute a Worksheet_SelectionChange sub of another module Jack Sons Excel Discussion (Misc queries) 4 December 11th 05 11:52 PM
Personal macro workbook and personal.xls John Kilkenny Excel Discussion (Misc queries) 1 June 14th 05 09:43 PM
Module Monty Excel Discussion (Misc queries) 4 May 19th 05 08:34 AM


All times are GMT +1. The time now is 05:17 PM.

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"