LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Displaying possible combinations

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying all combinations of a range of numbers Mally Excel Worksheet Functions 5 May 10th 16 07:54 AM
all possible combinations. Gaurav[_4_] Excel Discussion (Misc queries) 4 March 19th 09 06:15 PM
Combinations [email protected] Excel Programming 1 February 14th 08 09:56 PM
getting combinations vecky New Users to Excel 1 January 1st 06 12:37 AM
Displaying Combinations of Rows George B[_2_] Excel Programming 3 May 14th 05 11:23 PM


All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"