Bingo card

jooquase

New Member
Joined
Oct 7, 2006
Messages
4
Hi all, I was wondering if there was a way to have a series of Different Random results.
For example if I want to randomly generate a bingo card, I am able to Randomly fill the card, but I canot find a way to prevent duplicates in my colums ...
Does any one know of any way to do this ?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi and welcome to the board!

One way of doing this would be to add your generated numbers into an array and for each number scan down the array, if it already exists generate it again, if not add it and move to the next.

HTH

Chris
 
Upvote 0
Try:
Code:
Dim n(15) As Integer

Sub BingoCard()

  Randomize (Timer)
  
  [A1:E6].Clear
  [A1:E6].Select
  With Selection
    .HorizontalAlignment = xlCenter
    .VerticalAlignment = xlCenter
  End With

  [A1] = "B"
  [B1] = "I"
  [C1] = "N"
  [D1] = "G"
  [E1] = "O"
  
  [A2].Select
  
  For w = 0 To 4
    
    For x = 1 To 15
      n(x) = 0
    Next
    
    For y = 1 To 5
TryAgain:
      z = Int(15 * Rnd + 1)
      If n(z) <> 0 Then GoTo TryAgain
      n(z) = z
      ActiveCell.Offset(y - 1, w) = (w * 15) + z
    Next
  Next
  
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,369
Members
449,080
Latest member
Armadillos

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
Back
Top