Thread: Call a Function
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Call a Function

Hi Dave,

If i have a function named TestCode why can i not call it in this way?


You can. However, if the function returns a value, you may not observe any
response.

For demonstaryion purposes, I include a msgbox in the function:


Try:

'=============
Public Function ABC(aVal As Double)
ABC = aVal * 2
MsgBox ABC
End Function
'<<=============

'=============
Sub TestIt()
ABC (5)
Call ABC(100)
End Sub
'<<=============


---
Regards,
Norman



"Desert Piranha"
<Desert.Piranha.24n3vm_1142306702.1674@excelforu m-nospam.com wrote in
message news:Desert.Piranha.24n3vm_1142306702.1674@excelfo rum-nospam.com...

Hi all,

I can call a Macro like

'Call TestCode
or
'Run TestCode
or
TestCode
or use Select Case
etc

If i have a function named TestCode why can i not call it in this way?


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile:
http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=522044