+ Reply to Thread
Results 1 to 4 of 4

Convert Formula to User-Defined Function

  1. #1
    Registered User
    Join Date
    07-12-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    67

    Convert Formula to User-Defined Function

    Hey all,
    Is it possible to paste a formula as a UDF? For instance, let's say I have an extremely long nested formula, is there a way I can copy and paste it into the VBA editor without having to re-code the whole thing?

    Thanks,
    Andrew
    Last edited by SoothSailor; 11-26-2014 at 11:55 AM.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Convert Formula to User-Defined Function

    Formulas and VBA have very different syntax - you cannot paste a formula and expect VBA to be able to run it, but you can Evaluate it...
    Please Login or Register  to view this content.
    ... but I cannot think of a reason why yuou would want to do this, especially as native Excel Formulas are more efficient than VBA code doing the same thing...

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2407
    Posts
    25,977

    Re: Convert Formula to User-Defined Function

    You can also evaluate the formula itself, rather than referring to a cell containing the formula. This is almost a copy & paste into VBA but you have to double up any quotes.
    Please Login or Register  to view this content.
    You can also create a named formula in Excel that might do what you want without VBA.

    In any case, I'm not sure what the best solution is for your specific situation. We can give more specific advice if you show us the formula.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    07-12-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    67

    Re: Convert Formula to User-Defined Function

    Sweet! This is extremely helpful. Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help to Convert to User Defined Function-Sumproduct
    By susuyesyes in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-03-2014, 11:54 AM
  2. Trying to create UDF to produce different results depending on different inputs
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2014, 09:58 AM
  3. Use formula to create a User Defined Function
    By lindomsm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2013, 06:54 AM
  4. Convert Array Formula into VBA User Defined Function
    By hhhhwong in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-05-2013, 12:38 AM
  5. [SOLVED] User Defined Function To Add A Zero In A Concatenated Formula
    By BanburyS in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-29-2012, 02:23 AM

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