Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to return a variable that I have given a value within a function.
example: VarX = 10 and then I put in "return VarX" and I keep getting a compile error. Is there another way of returning the value in vba? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Function Example (Arg1 as Double) As Double
Example = Arg1*2 End Function "WannaBeExceller" wrote in message ... I am trying to return a variable that I have given a value within a function. example: VarX = 10 and then I put in "return VarX" and I keep getting a compile error. Is there another way of returning the value in vba? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Of course in my example Double should have been Long
Don't use Integers, use Longs (32 bits) -- Kind regards, Niek Otten "WannaBeExceller" wrote in message ... I am trying to return a variable that I have given a value within a function. example: VarX = 10 and then I put in "return VarX" and I keep getting a compile error. Is there another way of returning the value in vba? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you very much guys. Worked like a charm!!
|
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You don't need the Return key word
Public Function MyFunction () as integer dim varX as integer varX = 10 MyFunction = varX End Function -- HTH... Jim Thomlinson "WannaBeExceller" wrote: I am trying to return a variable that I have given a value within a function. example: VarX = 10 and then I put in "return VarX" and I keep getting a compile error. Is there another way of returning the value in vba? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
increment an integer in a formula with the fill function | Excel Worksheet Functions | |||
Search Function that returns an integer not #VALUE! | Excel Worksheet Functions | |||
how do I put in the IF function only integer as true values? | Excel Worksheet Functions | |||
What function to determine the second small integer from a list? | Excel Programming | |||
Is there a function to convert a string representing an integer i. | Excel Programming |