There’s a lot of ways for us to be able to generate random letters in Excel, one solution is to use a macro. To generate a six(6) characters code that contains uppercase letters add this macro to your excel file;


Sub GenerateRandomCode()
 Dim K As Integer
 Dim iTmp As Integer
 Dim J As Integer
 Dim strNumber As String
 Dim bOK As Boolean

 Range("A1").Activate
 Randomize
 For J = 1 To 100
 strNumber = ""
 For K = 1 To 6
 Do
 iTmp = Int((122 - 48 + 1) * Rnd + 48)
 Select Case iTmp
 Case 65 To 90
 bOK = True
 Case Else
 bOK = False
 End Select
 Loop Until bOK
 bOK = False
 strNumber = strNumber & Chr(iTmp)
 Next K
 ActiveCell.Value = strNumber
 ActiveCell.Offset(1, 0).Select
 Next J
End Sub

Run the macro and it will generate 100 random codes with six(6) uppercase letters.

SHARE

LEAVE A REPLY