View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rbp9ad[_2_] Rbp9ad[_2_] is offline
external usenet poster
 
Posts: 25
Default AddIn functions in code?

I wrote the function to return a vendor number from an account number.

Option Explicit
Function Vendor(VR As Variant) As String

Application.Volatile True


Dim Acct As Variant


Acct = Strings.Left(RRLookup(VR, 11), 12)

Select Case Acct
Case Is = "236SPDTI DTI", "207SPDI3 DI3", "207SPDTI DTI"
Vendor = "36359"
Case Is = "202SPDTI DTI"
Vendor = "2810"
Case Is = "240SPLIG LIG"
Vendor = "2814"
Case Else
Vendor = ""
End Select
End Function
The account number is looked up from a spreadsheet that is entered manually.
I was wondering if there was a way to make the function less sensitive to
typos and differing input (Additional spaces etc.).
"Vacation's Over" wrote in message
...
Yes it's a great book.

yes you can use functions in code
helpWorksheetfunction. see list of supported functions and note that
WorksheetFunction.functionname(stuffhere) is the typical syntax

Syntax is the hardest component of coding.

"Rbp9ad" wrote:

Can I use functions from addIns in VBA code? I have custom functions as
well
as some from Excel's addIns that I would like to use in a module. Is this
possible? (Also I am new to programming and I am trying to learn VBA from
the few examples in John Walkenbach's Excel 2003 Bible. Would his Excel
VBA
book be a good start?)