Click = Random Charaters Into A Cell

C

Chris

Thanks,

is there a way to make this into such away that when i click the cell the
random password is inputted stright away? as i dont want to have to copy and
past the formula each time

regards,

chris
 
M

Mike H

Chris,

Try this. Right click your sheet tab, view code and paste this in. It works
on Column C only and only if the cell is blank. The formula as supplied by
Teethless Mama has wrapped so you will have to unwrap it. Double click the
cell to get a number.


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Value = "" And ActiveCell.Column = 3 Then
Target.Formula =
"=CHAR(RANDBETWEEN(CODE(""A""),CODE(""Z"")))&CHAR(RANDBETWEEN(CODE(""A""),CODE(""Z"")))&CHAR(RANDBETWEEN(CODE(""a""),CODE(""z"")))&CHAR(RANDBETWEEN(CODE(""a""),CODE(""z"")))&CHAR(RANDBETWEEN(CODE(""a""),CODE(""z"")))&CHAR(RANDBETWEEN(CODE(""a""),CODE(""z"")))&CHAR(RANDBETWEEN(CODE(""a""),CODE(""z"")))&RANDBETWEEN(1,9)"
Target.Copy
ActiveCell.PasteSpecial xlPasteValues
Application.CutCopyMode = False
Target.Offset(1, 0).Select
End If
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top