Created
June 21, 2013 16:43
-
-
Save markshust/5832535 to your computer and use it in GitHub Desktop.
Excel Macro to create 30-char alphanumeric strings and insert into currently selected cells
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sub createRandstring30() | |
| Set MyRange = Selection | |
| Dim randstring As String | |
| Dim i As Integer | |
| For Each mycell In MyRange | |
| randstring = "" | |
| Randomize | |
| For i = 1 To 30 | |
| If Int((2 * Rnd) + 1) = 1 Then | |
| randstring = randstring & Chr(Int(26 * Rnd + 65)) | |
| Else | |
| randstring = randstring & Int(10 * Rnd) | |
| End If | |
| Next i | |
| mycell.Value = randstring | |
| Next mycell | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment