Function Azalea_POSTNET(ByVal ZIPcode As String) As String ' POSTools 16may12 jwhiting ' Copyright 2012 Azalea Software, Inc. All rights reserved. www.azaleabarcodes.com ' Creating a POSTNET barcode in Excel ' ZIPcode, is a 5-digit ZIP code, a 9-digit ZIP+4, or an 11-digit Delivery Point Barcode to be encoded as a POSTNET symbol. ' one way to groom ZIPcode is to reject anything that isn't the correct length ' embedded hyphens and spaces will trigger this (98126-2398 for instance) ' If Len(ZIPcode) <> 5 And Len(ZIPcode) <> 10 And Len(ZIPcode) <> 13 Then ' Exit Function ' End If ' stored ZIP codes usually contain embedded hyphens and spaces that need to be elminiated ' "12345-6789" becomes "123456789" and "12345-6789 00" becomes "12345678900" Select Case Len(ZIPcode) Case 13 ZIPcode = Left$(ZIPcode, 5) & Mid$(ZIPcode, 7, 4) & Right$(ZIPcode, 2) Case 10 ZIPcode = Left$(ZIPcode, 5) & Right$(ZIPcode, 4) End Select Dim i As Integer ' our loop counter Dim checkDigit As Integer ' the check digit variable checkDigit = 0 For i = 1 To Len(ZIPcode) checkDigit = checkDigit + Val(Mid(ZIPcode, i, 1)) Next i ' Concantenate the start bar, the ZIP code, the check digit, & the stop bar. Azalea_POSTNET = "s" + ZIPcode + Right(Str(100 - checkDigit), 1) + "s" ' Excel: B1=Azalea_POSTNET(A1) ' Or put another way, yourContainer.text=Azalea_POSTNET(yourInputString) End Function