Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,073
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Format for User Defined Function [email protected] Excel Discussion (Misc queries) 5 August 7th 06 11:27 PM
Refresh/Recalculate a Custom Function dch3 Excel Worksheet Functions 1 July 31st 06 01:59 PM
numerical integration integreat Excel Discussion (Misc queries) 4 May 12th 06 02:40 AM
Custom Function SPeterson Excel Discussion (Misc queries) 3 December 21st 05 07:12 PM
Custom function returning VALUE error alex.k Excel Discussion (Misc queries) 6 September 27th 05 03:05 AM


All times are GMT +1. The time now is 04:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"