Consulting

Results 1 to 5 of 5

Thread: custom function error.

  1. #1

    custom function error.

    I'm trying to create a custom function to use in my spread sheet, but it return a #NAME error, what am i doing wrong?
    [vba]Option Explicit

    Function PV_list(WOs As Range) As String
    Dim r As Range
    Dim list As String
    For Each r In WOs
    list = list & "^" & r.Value
    Next r
    PV_list = list
    End Function
    [/vba]
    Here is what it does:
    Lets say A1 = a, A2 = b and A3 = c, by typing =PV_list(A1:A3) is should get the following output: a^b^c
    This is saved in PERSONAL.xls.

    Thanks.
    Last edited by next; 04-14-2008 at 01:27 PM.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    =PERSONAL.XLS!PV_list(A1:A4)
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Thanks, it's working, but is there any way to make it so that i won't have to type "=personal.xls!" all the time?

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You could save the function in an Add-In (XLA file) See here
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Thanks i'll check that out!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •