Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Ned Help W/ Custom Function
Hi Guys, Im trying to make a custom function but I seem to unable to make the correct declaration I have the code below but its not displaying the data that I want The result should be Lynn Haven for C410 data and ABU for G538. but it only display 0. Function Company2(ByRef Company As Integer) If Company = "C410" Then Company = "Lynn Haven" ElseIf Company = "G538" Then Company = "ABU" End If End Function Can someone help me this? Thanks! -- japorms ------------------------------------------------------------------------ japorms's Profile: http://www.excelforum.com/member.php...fo&userid=6544 View this thread: http://www.excelforum.com/showthread...hreadid=571545 |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Ned Help W/ Custom Function
japorms wrote:
Hi Guys, Im trying to make a custom function but I seem to unable to make the correct declaration I have the code below but its not displaying the data that I want The result should be Lynn Haven for C410 data and ABU for G538. but it only display 0. Function Company2(ByRef Company As Integer) If Company = "C410" Then Company = "Lynn Haven" ElseIf Company = "G538" Then Company = "ABU" End If End Function Can someone help me this? Thanks! Hi, Will this work? Function Company2(ByRef Company As String) as String If Company = "C410" Then Company2 = "Lynn Haven" ElseIf Company = "G538" Then Company2 = "ABU" End If End Function Ken Johnson |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Ned Help W/ Custom Function
Two errors:
Company should be defined as STRING not INTEGER Return parameter is function name i.e. COMPANY2 not COMPANY Function Company2(ByRef Company As String) If Company = "C410" Then Company2 = "Lynn Haven" ElseIf Company = "G538" Then Company2 = "ABU" End If End Function "japorms" wrote: Hi Guys, Im trying to make a custom function but I seem to unable to make the correct declaration I have the code below but its not displaying the data that I want The result should be Lynn Haven for C410 data and ABU for G538. but it only display 0. Function Company2(ByRef Company As Integer) If Company = "C410" Then Company = "Lynn Haven" ElseIf Company = "G538" Then Company = "ABU" End If End Function Can someone help me this? Thanks! -- japorms ------------------------------------------------------------------------ japorms's Profile: http://www.excelforum.com/member.php...fo&userid=6544 View this thread: http://www.excelforum.com/showthread...hreadid=571545 |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Ned Help W/ Custom Function
Thanks! It's now working perfectly. :) Toppers Wrote: Two errors: Company should be defined as STRING not INTEGER Return parameter is function name i.e. COMPANY2 not COMPANY Function Company2(ByRef Company As String) If Company = "C410" Then Company2 = "Lynn Haven" ElseIf Company = "G538" Then Company2 = "ABU" End If End Function "japorms" wrote: Hi Guys, Im trying to make a custom function but I seem to unable to make the correct declaration I have the code below but its not displaying the data that I want The result should be Lynn Haven for C410 data and ABU for G538. but it only display 0. Function Company2(ByRef Company As Integer) If Company = "C410" Then Company = "Lynn Haven" ElseIf Company = "G538" Then Company = "ABU" End If End Function Can someone help me this? Thanks! -- japorms ------------------------------------------------------------------------ japorms's Profile: http://www.excelforum.com/member.php...fo&userid=6544 View this thread: http://www.excelforum.com/showthread...hreadid=571545 -- japorms ------------------------------------------------------------------------ japorms's Profile: http://www.excelforum.com/member.php...fo&userid=6544 View this thread: http://www.excelforum.com/showthread...hreadid=571545 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Custom Format for User Defined Function | Excel Discussion (Misc queries) | |||
Refresh/Recalculate a Custom Function | Excel Worksheet Functions | |||
numerical integration | Excel Discussion (Misc queries) | |||
Custom Function | Excel Discussion (Misc queries) | |||
Custom function returning VALUE error | Excel Discussion (Misc queries) |