View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_2_] Nigel[_2_] is offline
external usenet poster
 
Posts: 735
Default Mod 43 Check Digit calculator

UDF = user defined function, that can be used just like standard Excel
functions.

To install this code
Press Alt-F11 and the VBA editor will open. From the menu choose Insert,
then from the drop down click Module.
Copy then paste all of the code shown below.
Close the editor by pressing Alt-Q

To use the UDF, you type the function name e.g

=ModFT

as you would any Excel function, then open bracket

=ModFT(

Then either type the string you are trying to convert by putting in inside
double-quotes, then close brackets

=ModFT("MYSTRING")

or reference another cell with the string you wish to convert, so lets
assume your string is in A1, you can type in B1 the function and reference
to A1

=ModFT(A1)

Every time you change the value in A1 the converted value appears in B1 (in
this example)


' copy from line below to end of copy
Const charSet As String = _
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"
Function ModFT(sValue As String)
Dim i As Integer, T As Long
For i = 1 To Len(Trim(UCase(sValue)))
T = InStr(charSet, Mid(sValue, i, 1)) - 1 + T
Next i
ModFT = sValue & Mid$(charSet, (T Mod 43 + 1), 1)
End Function
' end of copy




--

Regards,
Nigel




"CLI-Art" wrote in message
...
I am a newer user to excel and this post has me lost. Can you "dumb" it up
a
bit?

"Nigel" wrote:

Here is a UDF. Add it to a standard code module and use formula in cell.
e.g.

=ModFT("123") as a direct conversion of some text or
=ModFT(A3) as a range reference


Const charSet As String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"
Function ModFT(sValue As String)
Dim i As Integer, T As Long
For i = 1 To Len(Trim(UCase(sValue)))
T = InStr(charSet, Mid(sValue, i, 1)) - 1 + T
Next i
ModFT = sValue & Mid$(charSet, (T Mod 43 + 1), 1)
End Function

--

Regards,
Nigel




"CLI-Art" wrote in message
...
Is there a mod43 check digit calculator in Excel. If not, has anyone
out
there made one?