+ Reply to Thread
Results 1 to 9 of 9

New function for more variables

  1. #1
    Registered User
    Join Date
    04-05-2014
    Location
    Europe
    MS-Off Ver
    Excel 2013
    Posts
    6

    New function for more variables

    Hello I would like to create own function in VBA for range.
    I've got this:

    Please Login or Register  to view this content.
    But I cant make it works with cells, offset or anything I know, so I think that new fuction will be better for this case. Any helps? Thak you for your time.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,594

    Re: New function for more variables

    Thanks for the mod.
    Last edited by protonLeah; 08-09-2014 at 03:37 PM.
    Ben Van Johnson

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: New function for more variables

    What do you want to do with your UDF??
    - Battle without fear gives no glory - Just try

  4. #4
    Registered User
    Join Date
    04-05-2014
    Location
    Europe
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: New function for more variables

    Process 3 cells in each row and sum the output. (Ai/Bi)-Ci = x

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: New function for more variables

    Perhaps
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,594

    Re: New function for more variables

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-05-2014
    Location
    Europe
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: New function for more variables

    There is no problem with 0 value (I tought that loop starts from "For") but its returning some errors I cant type W = W + ((T / A) - B)
    r-t error: 13

    PCI: this is function for one roow, but I need SUM from each

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,594

    Re: New function for more variables

    First you say:
    Range("D30").Value = 0


    "... I tought that loop starts from "For ... "
    It does but inside the loop you say:
    W = Range("D30").Value

    D30 = 0, therefore W = 0 (each time through the loop)

    Next, you calculate W. But that line (in the loop): W = Range("D30").Value wipes out that calculation at the next iteration of the loop.
    The last time through the original loop W is calculated but not written do D30, it's just lost.

    The code I gave you accumulates the twenty calculations and writes them to D30 (tested). The calculation equation did not give me any error.

  9. #9
    Registered User
    Join Date
    04-05-2014
    Location
    Europe
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: New function for more variables

    Thank you I had problems with blanks rows v1 code is:
    Please Login or Register  to view this content.
    Thank you for your help.

+ 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. Function with 2 variables
    By Peter1245 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2013, 10:29 AM
  2. [SOLVED] IF function with three variables
    By freethinker in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-14-2013, 07:03 AM
  3. IF function for 2 or more variables
    By speakerbruce in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-29-2013, 01:33 PM
  4. Replies: 3
    Last Post: 09-11-2012, 02:03 AM
  5. Excel 2007 : Function with three variables
    By SWPRINT in forum Excel General
    Replies: 2
    Last Post: 11-02-2010, 12:25 PM

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