Passing a string to a function instead of a cell reference

R

rbennu

Currently using excel2003 with the following UDF

Function EmpName(nam3 As String)
Select Case nam3
Case "John"
EmpName = "First"
Case "Doe"
EmpName = "Last"
End Select
End Function

This works if I use a cell reference i.e. A1=John, =EmpName(A1) but fails if
I use =EmpName(John). I can get both forms to work if I am passing a number
and evalualting the case as a number. How do i get it to use =EmpName(John)?

Thank you in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top