|
-
Jun 18th, 2008, 03:37 PM
#1
Thread Starter
New Member
Problem with my function
Sorry if this is the wrong spot for this, but i'm currently writing code in Microsoft Visual Basic in excel 2000.
here is the beginning of a function
Function ErlBLines(blockingProbablity as Double, traffic as Double) as Double
...
...
End Function
One thing i could do with Python is give a variable a value that was optional. Basically it would remain the same value unless the user changed it.
so in python what i wan to do would look like this
def ErlBLines(blockingProbability, traffic, error=0):
...
...
return ...
Is there a way i can do this in VB?
Basically i want ether of these to be acceptable inputs in excel.
=ErlBLines(.02,10)
And
=ErlBLines(.02,10,.1)
Thanks for your help in advance
-
Jun 18th, 2008, 03:42 PM
#2
Addicted Member
Re: Problem with my function
I'm pretty sure that's actually VBA that you are working with but this work.
VB Code:
Function ErlBLines(blockingProbablity as Double, traffic as Double,Optional otherVariable As Something = 0) as Double
...
...
End Function
Simple little bugs 13 : Me 1
Law of Bugs - That one bug you missed will be found almost immediately, by your customer.
I wonder if anyone has ever asked for a User Surly interface?
-
Jun 18th, 2008, 03:46 PM
#3
New Member
Re: Problem with my function
I thought I could help....I opened Excel, I wrote basically the same as what was posted above, I rejoiced in my success, I came back to the webpage, and it had already been answered 
Nice work Veritas
-
Jun 18th, 2008, 03:46 PM
#4
Thread Starter
New Member
Re: Problem with my function
Thanks alot, that does the trick. I did a little bit of programming in vb like 5 years ago for HS, but i've forgotten it all so now i'm teaching myself it on the job. Got to love google and the forums 2.
Yea VBA sounds right, but i don't know what the difference is.
-
Jun 18th, 2008, 05:20 PM
#5
Re: Problem with my function
It is actually VBA, but unfortunately that isn't made particularly obvious (even the About screen gives the impression it is VB). There are lots of similarities, but there are also some differences (particularly when it comes to controls) which can easily cause confusion.
As such, this thread belongs in our Office Development/VBA forum, and I have moved it there.
As you now have this question sorted out, could you please do us a little favour, and mark the thread as Resolved?
(this saves time reading for those of us who like to answer questions, and also helps those who search to find answers)
You can do this by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|