From: rbennu on 2 Mar 2010 18:49 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
From: Joe User on 2 Mar 2010 19:16 "rbennu" wrote: > How do i get it to use =EmpName(John)? =EmpName("John") just you use strings in any Excel formula. ----- original messages ----- "rbennu" wrote: > 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
From: rbennu on 2 Mar 2010 22:47 Much Thanks! "Joe User" wrote: > "rbennu" wrote: > > How do i get it to use =EmpName(John)? > > =EmpName("John") > > just you use strings in any Excel formula. > > > ----- original messages ----- > > > > "rbennu" wrote: > > 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
|
Pages: 1 Prev: SQL query in excel (VB) using multiple parameters Next: Convert Cells to uppercase |