L
Legacy 143009
Guest
Hi,
I am stuck while making an If statement. I have two playing cards. Let's say card1 and card2. Suits have no significance.
If I add between 1 and 6 to the card2's value and can still reach card1's value, then card1 will go to slot1 and card2 will go to slot2.
If vice-versa card1 will go to slot2 and card1 will go to slot1.
I wrote some code but works buggy.
Some examples:
9 and 6 → 6 will be in slot2 because If I add 3 to 6, I can reach to 9.
3 and 12 → 12 will be in slot2 because if I add 4 to12, I can reach to 3. (yes there is a modulus 13 thing because they are playing cards)
4 and 10 → 4 will be in slot2 because if I add 6 to4, I can reach to 10.
I am stuck while making an If statement. I have two playing cards. Let's say card1 and card2. Suits have no significance.
If I add between 1 and 6 to the card2's value and can still reach card1's value, then card1 will go to slot1 and card2 will go to slot2.
If vice-versa card1 will go to slot2 and card1 will go to slot1.
I wrote some code but works buggy.
Some examples:
9 and 6 → 6 will be in slot2 because If I add 3 to 6, I can reach to 9.
3 and 12 → 12 will be in slot2 because if I add 4 to12, I can reach to 3. (yes there is a modulus 13 thing because they are playing cards)
4 and 10 → 4 will be in slot2 because if I add 6 to4, I can reach to 10.
VBA Code:
If ((card2+ 5) Mod 13) + 1 >= card1 Or card1 <= card2 Then
slot1 = card1
slot2 = card2
Else
slot1 = card2
slot2 = card1
End If