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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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