J
James8309
Hi everyone,
I was researching on how to display possible poker hands (5 cards)
using a VBA. I found this code within this group. However as you can
see, this code below does ignore the suits. Is it possible to alter
this code to display different possible poker hands including the
suits?
Thank you very much.
where;
1. Diamond = "D"
2. Heart = "H"
3. Spade = "S"
4. Clover = "C"
'Ace' being = 1, 'King' being = 13
Sub poker_hand2()
Dim card1, card2, card3, card4, card5 As Integer
For card1 = 1 To 13
For card2 = card1 To 13
For card3 = card2 To 13
For card4 = card3 To 13
For card5 = card4 To 13
If Not (card1 = card2 And card2 = card3 And
card3 =
card4 And card4 = card5) Then
ActiveCell = card1 & "-" & card2 & "-" &
card3 &
"-" & card4 & "-" & card5
If ActiveCell.Row = 65536 Then
ActiveCell.Offset(-65535, 1).Select
Else
ActiveCell.Offset(1, 0).Select
End If
End If
Next card5
Next card4
Next card3
Next card2
Next card1
End Sub
I was researching on how to display possible poker hands (5 cards)
using a VBA. I found this code within this group. However as you can
see, this code below does ignore the suits. Is it possible to alter
this code to display different possible poker hands including the
suits?
Thank you very much.
where;
1. Diamond = "D"
2. Heart = "H"
3. Spade = "S"
4. Clover = "C"
'Ace' being = 1, 'King' being = 13
Sub poker_hand2()
Dim card1, card2, card3, card4, card5 As Integer
For card1 = 1 To 13
For card2 = card1 To 13
For card3 = card2 To 13
For card4 = card3 To 13
For card5 = card4 To 13
If Not (card1 = card2 And card2 = card3 And
card3 =
card4 And card4 = card5) Then
ActiveCell = card1 & "-" & card2 & "-" &
card3 &
"-" & card4 & "-" & card5
If ActiveCell.Row = 65536 Then
ActiveCell.Offset(-65535, 1).Select
Else
ActiveCell.Offset(1, 0).Select
End If
End If
Next card5
Next card4
Next card3
Next card2
Next card1
End Sub