View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arne Hegefors Arne Hegefors is offline
external usenet poster
 
Posts: 244
Default Calling a function

Hi ! I am trying to call a function in a sub. However there is some error,
Compilation error, sub function or property expected. What am I doing wrong?

In the sub:

StrikePrice (secID)

.....and the function
Public Function StrikePrice(secID As String) As String
secID = Split(secID, " ")(1)
If InStr(secID, "C") Then
secID = Split(secID, "C")(1)
Else
If InStr(secID, "P") Then
secID = Split(secID, "P")(1)
Else
MsgBox "Error"
End If
End If
StrikePrice = secID
End Function