Results 1 to 21 of 21

Generating a 4 part Alphanumeric Sequence

Threaded View

  1. #19
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Generating a 4 part Alphanumeric Sequence

    Here is an explanation to my code:

    Sub BarCode()
    
    ' Declare variable types (I gave them random letters - a, b, and c but could be x, y, and z or any other letter or name you choose
    Dim a As Integer, b As Integer, c As Integer, d As Integer, e As String, r As Long
    
    ' Create four nested loops
    For a = 1 To 8
        For b = 1 To 72
            For c = 1 To 13
                For d = 1 To 16
                  ' go to next row
                    r = r + 1
                      ' Convert the variable "a" to one of the letters you wanted
                        e = Choose(a, "A", "B", "C", "D", "E", "F", "G", "H")
                          ' Concantenate all the numbers and letter together
                            Range("A" & r) = e & " - " & Format(b, "00") & " - " & Format(c, "00") & " - " & Format(d, "00")
                Next
            Next
        Next
    Next
    
    End Sub
    Last edited by abousetta; 06-06-2012 at 01:01 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1