A
aztecbrainsurgeon
No question here, just a procedure example for the archive.
Insert a specified length of a random letter and number combination
into each cell in the selection
Sub RandomLetterNumberCombinations()
'Prompts for the length of a Random letter and number
'combination that is inserted into each cell in selection
Dim RandomLetOrNum, RanNumOrLetDecider As Integer
Dim c As Range
Dim FinalResult As String
Dim Length%
On Error Resume Next
Length = Application.InputBox(prompt:="What length would you like
the random letter/number
combination for each cell in selection?", Title:="Insert Random Letter
Number Combinations", _
Default:=1, Type:=1) 'type 1 is
number
If Length = False Then Exit Sub
For Each c In Selection
For i = 1 To Length
RanNumOrLetDecider = Int(Rnd * 2) 'decide whether number
or character
If RanNumOrLetDecider = 1 Then
RandomLetOrNum = Int(9 * Rnd())
End If
If RanNumOrLetDecider = 0 Then
RandomLetOrNum = Chr(Rnd() * 26 + 65)
End If
FinalResult = RandomLetOrNum & FinalResult
Next i
c.Value = FinalResult
''Reset the result to nothing for the next cell's calculation
FinalResult = ""
Next c
End Sub
search criteria:
random letter and number generator
random combination of letters and numbers
random numbers and letters in combination
combination random letters and numbers
insert random characters
return random combinations
Insert a specified length of a random letter and number combination
into each cell in the selection
Sub RandomLetterNumberCombinations()
'Prompts for the length of a Random letter and number
'combination that is inserted into each cell in selection
Dim RandomLetOrNum, RanNumOrLetDecider As Integer
Dim c As Range
Dim FinalResult As String
Dim Length%
On Error Resume Next
Length = Application.InputBox(prompt:="What length would you like
the random letter/number
combination for each cell in selection?", Title:="Insert Random Letter
Number Combinations", _
Default:=1, Type:=1) 'type 1 is
number
If Length = False Then Exit Sub
For Each c In Selection
For i = 1 To Length
RanNumOrLetDecider = Int(Rnd * 2) 'decide whether number
or character
If RanNumOrLetDecider = 1 Then
RandomLetOrNum = Int(9 * Rnd())
End If
If RanNumOrLetDecider = 0 Then
RandomLetOrNum = Chr(Rnd() * 26 + 65)
End If
FinalResult = RandomLetOrNum & FinalResult
Next i
c.Value = FinalResult
''Reset the result to nothing for the next cell's calculation
FinalResult = ""
Next c
End Sub
search criteria:
random letter and number generator
random combination of letters and numbers
random numbers and letters in combination
combination random letters and numbers
insert random characters
return random combinations