View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Newbie question - regarding function parameters

Public Function myfunction(var As Variant) As String
Dim str As String

If TypeOf var Is Range Then
str = "Is Range"
ElseIf VarType(var) = vbString Then
str = "Is String"
Else
str = "is something else"
End If

myfunction = str
End Function


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Thomas Söhne" wrote in message
...
Hello Folks,

i want to write a function, to call from my Excelsheets.
As param i want to pass either a String or a Cellreference on a Cell
containing the string.

Do i have to declare the param in functionsheader as variant?
If so, how can i check if it is a Cellreference or a String?

I would be glad to get any hint on, where to look and read in OH or other
material.

Greetings,
Thomas