Forum Discussion
jim johnstone
Feb 13, 2018Copper Contributor
Random alphanumeric generation in a cell
Hi everyone.
A bit of a newbie when it comes to Excel here.
What I'm trying to achieve is a means of automatically generating an alphanumeric string, lets say 7 long, when clicking on a cell....
Deleted
Feb 14, 2018'Shorter Range("C8") version
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address = Me.Range("C8").Address Then
If VBA.Len(Target.Value) < 1 Then
Randomize
Target.Value2 = VBA.Int((9999999 - 1000001 + 1) * Rnd + 1000001)
End If
Cancel = True
End If
End Sub
jim johnstone
Feb 14, 2018Copper Contributor
Thanks again-that's perfect.
Kindest regards,
Jim