Function Azalea_Code_39_checkdigit(ByVal Code39 As String) As String ' C39Tools 16may12 jwhiting ' Copyright 2012 Azalea Software, Inc. All rights reserved. www.azaleabarcodes.com ' Creating a Code 39 barcode with the optional mod 43 check digit in Excel ' Your input, Code39, is a string to be encoded as a Code 39 symbol that includes the mod 43 check digit. ' yourData must be the Code 39 character set. Input error checking is your responsibility. ' The standard Code 39 character set is: A-Z (upppercase), 0-9, $ % + - . / and the space character. Dim i As Integer ' our loop counter Dim subtotal As Integer ' the check digit subtotal Dim temp As String ' a temporary placeholder temp = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" ' calculate the mod 43 check digit For i = 1 To Len(Code39) subtotal = InStr(temp, Mid(Code39, i, 1)) - 1 + subtotal Next i Azalea_Code_39_checkdigit = Mid(temp, (subtotal Mod 43 + 1), 1) ' Excel: B1=Azalea_Code_39_checkdigit(A1) ' Or put another way, yourContainer.text=Azalea_Code_39_checkdigit(yourInputString) End Function