Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / August 2006

Tip: Looking for answers? Try searching our database.

Ned Help W/ Custom Function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
japorms - 14 Aug 2006 21:29 GMT
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!

Signature

japorms

Ken Johnson - 14 Aug 2006 21:39 GMT
> Hi Guys,
>
[quoted text clipped - 16 lines]
>
> 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
Toppers - 14 Aug 2006 21:44 GMT
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

> Hi Guys,
>
[quoted text clipped - 16 lines]
>
> Thanks!
japorms - 14 Aug 2006 21:58 GMT
Thanks!  It's now working perfectly.

:)

Toppers Wrote:
> Two errors:
>
[quoted text clipped - 39 lines]
> > View this thread
> http://www.excelforum.com/showthread.php?threadid=571545
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.