danbates77
Board Regular
- Joined
- Jan 10, 2017
- Messages
- 52
- Office Version
- 2016
Hi,
I have this code that randomly picks a different name from a list.
The F9 part in the code is to trigger this formula which is in H31
What I would like is when it randomly picks a name and enters it in column E, it cannot enter that name again.
I hope this makes sense.
Thanks
Dan
I have this code that randomly picks a different name from a list.
Code:
Sub CommandButton1_Click()
Dim lrcd As Long
SendKeys "%^{F9}"
Range("H31").Copy
'Range("C2:C7").PasteSpecial xlPasteValues
lrcd = Sheets("Sheet1").Range("E" & Rows.Count).End(xlUp).Row
Sheets("Sheet1").Cells(lrcd + 1, "E").PasteSpecial xlPasteValues
End Sub
The F9 part in the code is to trigger this formula which is in H31
Code:
=INDEX(A1:A12,RANDBETWEEN(1,COUNTA(A1:A12)),1)
What I would like is when it randomly picks a name and enters it in column E, it cannot enter that name again.
I hope this makes sense.
Thanks
Dan