try to develop user-define function named abc(),due to the error "procedure too large" , i was forced to split the code and now the function return 0 instead expected result "3"
![]()
Please Login or Register to view this content.
try to develop user-define function named abc(),due to the error "procedure too large" , i was forced to split the code and now the function return 0 instead expected result "3"
![]()
Please Login or Register to view this content.
Your functions are not connected to each other, nor are they currently open to feeding parameters one to another.
In this function you are setting abc = to p1 +p2, but in the code above that in the function there is no code to give values to P1 or P2. So you are adding 0 + 0. You'll need to use INDEX100 to resolve p1 & P2 first.![]()
Please Login or Register to view this content.
I've merged that into one function that would appear to do the correct thing:
I'm assuming the lines in red will actually be removed and you will use the function to feed in the 4 parameters via cell reference.![]()
Please Login or Register to view this content.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
that what i am looking for, how to make the code connected to each other or feeding parameters to another???
the code you merged for me is not what i need,because i had lots of calculation in my code under one function which causing error"procedure too large" and now i forced to split the code.
yeah,the line in red will remove and will feed the 4 parameters via cell reference
How long was the procedure too large?
When creating a function, the parameters in the () denote the values that will be used in the function. When calling that function from another function, be sure to insert those parameters into the call, the same way you fill out a formula's parameters as you enter it into a cell.
In your original code above, the INDEX100 could be used to bring back a single result. But it looks like you need results to resolve the values of P1 and P2. I would suggest creating functions for those.
Here's a very simple example of what I mean. Here I've created a GetP1 and a GetP2 function, within those functions you can do whatever routines you need, but the end result is a single value fed back as the result of GetP1. In the main macro, that result is stored into a variable and used as needed.
![]()
Please Login or Register to view this content.
Last edited by JBeaucaire; 05-14-2013 at 01:09 PM.
my code is over 64 kb in a single function without code splitting,that why the error pop out.
that what i am looking for,thank you very much.
Last edited by ck_123; 05-15-2013 at 09:56 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks