Raffle Draw with Multiple Prices

W1nu

New Member
Joined
Jun 26, 2021
Messages
2
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi,
I am making an online raffle drawer for a lottery with multiple prices, and have assembled one based on what I could find on google and YouTube. I have a button with a VBA code which picks winner 1,2,3 etc in consecutive order (see worksheets below). However, I need to remove the ticket for the winner of the previous price before picking the next, so that the same ticket can't be drawn twice. I want this function to be part of the VBA code (attached below) for the button I have made.

With VBA, how can I delete the cell-values in a table-row (without deleting the entire row) based on the ticket that is being drawn?

Before Clicking on Button:
Raffle Draw, Draft.xlsm
ABCDEFGHIJKLMNOPQRS
1RandomRankNameContact Info #TicketNr
20,6319922Peterpeter@gmail.com1
30,47503114Kimkim@gmail.com2
40,36067655AlexanderAlexander@gmail.com3Wining TicketWinner NameContact InfoPriceWinnerContact Info
50,61878693Johnjohn@gmail.com46craigcraig@gmail.com1
60,09919966Wileywiley@gmail.com52
70,78949381craigcraig@gmail.com63
8  74
9  8
10  9
11  10
12  11
13  12
Entries
Cell Formulas
RangeFormula
A2:A13A2=IF(C2="","",RAND())
B2:B13B2=IF([@Random]="","",RANK($A2,$A$2:$A$22)+COUNTIF(B1,B1:B1)-1)
K5K5=VLOOKUP($Q$5,B2:E7,4,FALSE)
M5M5=VLOOKUP($Q$5,B2:E7,2,FALSE)
O5O5=VLOOKUP($Q$5,Table2[[Rank]:[Contact Info ]],3,FALSE)


After Clicking on Button:
Raffle Draw, Draft.xlsm
ABCDEFGHIJKLMNOPQRS
1RandomRankNameContact Info #TicketNr
20,18428846Peterpeter@gmail.com1
30,82176532Kimkim@gmail.com2
40,22156325AlexanderAlexander@gmail.com3Wining TicketWinner NameContact InfoPriceWinnerContact Info
50,52434054Johnjohn@gmail.com45Wileywiley@gmail.com1Wileywiley@gmail.com
60,82440661Wileywiley@gmail.com52
70,73417993craigcraig@gmail.com63
8  74
9  8
10  9
Entries
Cell Formulas
RangeFormula
A2:A10A2=IF(C2="","",RAND())
B2:B10B2=IF([@Random]="","",RANK($A2,$A$2:$A$22)+COUNTIF(B1,B1:B1)-1)
K5K5=VLOOKUP($Q$5,B2:E7,4,FALSE)
M5M5=VLOOKUP($Q$5,B2:E7,2,FALSE)
O5O5=VLOOKUP($Q$5,Table2[[Rank]:[Contact Info ]],3,FALSE)


VBA:
VBA Code:
Sub Draw_New_Winner()

Dim x As Long

For x = 1 To 2000

Calculate

Next x

Application.Calculation = xlCalculationManual
Sheet2.Range("R8").End(xlUp).Offset(1, 0).Value = Sheet2.Range("M5").Value

Sheet2.Range("S8").End(xlUp).Offset(1, 0).Value = Sheet2.Range("O5").Value

End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,176,670
Messages
5,904,378
Members
435,088
Latest member
Kingsof82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top