Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Displaying all combinations of a range of numbers | Excel Worksheet Functions | |||
all possible combinations. | Excel Discussion (Misc queries) | |||
Combinations | Excel Programming | |||
getting combinations | New Users to Excel | |||
Displaying Combinations of Rows | Excel Programming |