MarkCBB
Active Member
- Joined
- Apr 12, 2010
- Messages
- 497
Hi there,
I need to add anther argument to this code:
I need at add another do while that checks that the column to the right also has a count of one.
I need to add anther argument to this code:
Code:
Sub TestRun()
Range("A1") = InputBox("How many Winners would you like to pick?")
MsgBox ("This is a test run. All test winners will be cleared afterwards!")
Range("B2").Select
Do
ActiveCell.Formula = "=INDEX(OFFSET(Entries!$A$1,1,0,COUNTA(Entries!A:A)),RANDBETWEEN(1,COUNTA(Entries!A:A)-1))"
Do While WorksheetFunction.CountIf(ActiveCell.EntireColumn, ActiveCell.Value) > 1
Do While WorksheetFunction.CountIf(ActiveCell.Offset(1, 0).EntireColumn, ActiveCell.Value) > 1
Loop
ActiveCell.Copy
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Offset(0, -1) = ""
MsgBox ("" & Range("A1").Value & " Random test winner/s have been selected!")
MsgBox ("Test Run Complete! " & Range("A1").Value & " Test winner/s will now be cleared")
Range("B2:B100").ClearContents
Range("B2").Select
End Sub
I need at add another do while that checks that the column to the right also has a count of one.