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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

ChrisUK

Well-known Member
Joined
Sep 3, 2002
Messages
675
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
 

xapie128

Board Regular
Joined
Aug 26, 2006
Messages
82
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
 

Forum statistics

Threads
1,136,350
Messages
5,675,246
Members
419,557
Latest member
razlevav

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