+ Reply to Thread
Results 1 to 5 of 5

how to use an Excel function within an udf

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    Omaha,ne
    MS-Off Ver
    Excel 2007
    Posts
    2

    how to use an Excel function within an udf

    I would like to create an udf with the text function. For example: wojob=text(wo,"ooooo") & text(job, "ooo") with wo being the value in one cell and job is a other. Thanks.
    Last edited by jollycub; 05-21-2013 at 11:19 AM. Reason: Change heading to solved

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: how to use an Excel function within an udf

    VBA has a Format function that is almost the same as the worksheet TEXT function.
    wojob = Format(wo, "00000") & Format(job, "000")

    Or you can use the TEXT function like this...
    With Application.WorksheetFunction
    wojob = .Text(wo, "00000") & .Text(job, "000")
    End With

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: how to use an Excel function within an udf

    <Frog wins> <sigh>
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: how to use an Excel function within an udf

    You're still more interesting than me Al.

  5. #5
    Registered User
    Join Date
    05-20-2013
    Location
    Omaha,ne
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: how to use an Excel function within an udf

    Thanks, here is my function:

    Please Login or Register  to view this content.
    Last edited by arlu1201; 05-21-2013 at 11:45 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1