Hallo Affe
Vba kentnisse vorrausgesetzt!
Auf die schnelle,nicht optimiert!
Als Ansatz vielleicht!
Einfach mal Starten,dann siehst was da passiert!
Gruß Nighty
Option Explicit
Sub Bingo()
Randomize Timer
Dim zahl(25) As Integer, endeindex As Integer, allezahlen As Integer, ziehung As Integer, gezogen As Integer, zaehler4 As Integer
Dim zaehler1 As Long, zaehler2 As Long, zaehler3 As Long
Dim Zelle As Range, zelle1 As Range
Range("A1:E5").Interior.ColorIndex = xlNone
Range("H1") = ""
zaehler1 = 1
endeindex = 75
ReDim zuzahl(75) As Integer
For allezahlen = 1 To 75
zuzahl(allezahlen) = allezahlen
Next allezahlen
For ziehung = 1 To 25
gezogen = Int(Rnd * endeindex) + 1
zahl(ziehung) = zuzahl(gezogen)
zuzahl(gezogen) = zuzahl(endeindex)
endeindex = endeindex - 1
ReDim Preserve zuzahl(endeindex)
zaehler2 = zaehler2 + 1
If zaehler2 = 6 Then
zaehler1 = zaehler1 + 1
zaehler2 = 1
End If
Cells(zaehler1, zaehler2) = zahl(ziehung)
Next ziehung
ReDim zuzahl(75) As Integer
For allezahlen = 1 To 75
zuzahl(allezahlen) = allezahlen
Next allezahlen
For ziehung = 1 To 5
gezogen = Int(Rnd * endeindex) + 1
zahl(ziehung) = zuzahl(gezogen)
zuzahl(gezogen) = zuzahl(endeindex)
endeindex = endeindex - 1
zaehler3 = zaehler3 + 1
ReDim Preserve zuzahl(endeindex)
Cells(zaehler3, 7) = zahl(ziehung)
Next ziehung
For Each Zelle In Range("A1:E5")
For Each zelle1 In Range("G1:G5")
If Cells(Zelle.Row, Zelle.Column) = Cells(zelle1.Row, zelle1.Column) Then
Cells(Zelle.Row, Zelle.Column).Interior.ColorIndex = 3
End If
Next zelle1
Next Zelle
For zaehler4 = 1 To 5
If Cells(zaehler4, 1).Interior.ColorIndex = 3 _
And Cells(zaehler4, 2).Interior.ColorIndex = 3 _
And Cells(zaehler4, 3).Interior.ColorIndex = 3 _
And Cells(zaehler4, 4).Interior.ColorIndex = 3 _
And Cells(zaehler4, 5).Interior.ColorIndex = 3 Then
Cells(1, 8) = "Sieg"
End If
If Cells(1, zaehler4).Interior.ColorIndex = 3 _
And Cells(2, zaehler4).Interior.ColorIndex = 3 _
And Cells(3, zaehler4).Interior.ColorIndex = 3 _
And Cells(4, zaehler4).Interior.ColorIndex = 3 _
And Cells(5, zaehler4).Interior.ColorIndex = 3 Then
Cells(1, 8) = "Sieg"
End If
Next zaehler4
If Cells(1, 1).Interior.ColorIndex = 3 _
And Cells(2, 2).Interior.ColorIndex = 3 _
And Cells(3, 3).Interior.ColorIndex = 3 _
And Cells(4, 4).Interior.ColorIndex = 3 _
And Cells(5, 5).Interior.ColorIndex = 3 Then
Cells(1, 8) = "Sieg"
End If
If Cells(5, 1).Interior.ColorIndex = 3 _
And Cells(4, 2).Interior.ColorIndex = 3 _
And Cells(3, 3).Interior.ColorIndex = 3 _
And Cells(2, 4).Interior.ColorIndex = 3 _
And Cells(1, 5).Interior.ColorIndex = 3 Then
Cells(1, 8) = "Sieg"
End If
End Sub