Never mind,,, Figured it Out!!
Corrected as follows:
Sub TestIt()
arg1 = Range("b6").Value
arg2 = Range("B10").Value
MyAnswer = CustomFunction(arg1, arg2)
MsgBox "The Answer is " & MyAnswer
End Sub
Function CustomFunction(x, y)
CustomFunction = x * y
End Function
"Jim May" wrote in message
...
I entered the following:
Sub TestIt()
arg1 = Range("b6").Value
arg2 = Range("B10").Value
CustomFunction arg1, arg2
MsgBox "The Answer is " & CustomFunction << But I get Compile error
here!!
Why?
End Sub
Function CustomFunction(x, y)
CustomFunction = x * y
End Function
"Dana DeLouis" wrote:
customFunction(arg1,arg2)
Hi. With your use of ( ), the function is expecting to return a value.
Try
it without the use of ( ).
Sub TestIt()
Dim arg1, arg2
CustomFunction arg1, arg2
'or..
Call CustomFunction(arg1, arg2)
End Sub
Function CustomFunction(x, y)
CustomFunction = x * y
End Function
--
HTH. :)
Dana DeLouis
Windows XP, Office 2003
"mattsvai" wrote
in
message ...
How can I call a custom function without VBA asking me to assign it to
a
variable?
Ex:
Sub test()
customFunction(arg1,arg2)
end Sub
is there any way to do this without msgboxing it or assigning it?
Cheers
--
mattsvai
------------------------------------------------------------------------
mattsvai's Profile:
http://www.excelforum.com/member.php...o&userid=31134
View this thread:
http://www.excelforum.com/showthread...hreadid=511819