Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
no question here, just an example procedure for the archive.
Prompts user for the number of random letters to be inserted into each cell in the active selection. The procedure seems to be limited to up to 39 random letters per cell. Sub RandomLETTERSGenerator() 'Prompts for the number of Random letters for each cell in selection 'Seems to be limited to up to 39 random letters per cell On Error Resume Next Dim LetterNum% Dim RanBaseLetter, RanAddLetter, RanAllLetters As String RanBaseLetter = "CHAR(TRUNC(RAND()*26+65))" RanAddLetter = "&CHAR(TRUNC(RAND()*26+65))" LetterNum = Application.InputBox(prompt:="How many random letters do you want in each cell in selection?", Title:="Insert Random Letter(s)", _ Default:=1, Type:=1) 'type 1 is number If LetterNum = False Then Exit Sub If LetterNum = 1 Then Selection.FormulaR1C1 = "=" & RanBaseLetter End If If LetterNum 1 Then For i = 1 To LetterNum - 1 RanAllLetters = RanAddLetter & RanAllLetters Next i Selection.FormulaR1C1 = "=" & RanBaseLetter & RanAllLetters End If 'Paste value the formulas Selection.Value = Selection.Value End Sub return random letters insert random letters generate random letters random letter generator prompt for random letter(s) insertion |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
random combination of letters | Excel Worksheet Functions | |||
return random letters - an example | Excel Programming | |||
trying to find random drive letters | Excel Programming | |||
Display sum of selection with SelectionChange procedure | Excel Programming |