|
-
Nov 25th, 2005, 03:09 PM
#1
Thread Starter
Addicted Member
An excel card game
I am making a card game as part of my school work using excel vba macro. I am stuck with the stick part when the user presses stick to end his go and let the computer has its.
I have this but i don't know whats wrong:
VB Code:
Sub DealerStick3()
dealer = Range("F22").Value
setdef = 17
If dealer < setdef Then
stick3
Else
ActiveCell.FormulaR1C1 = "=SUM(R[-5]C:R[-1]C)"
End
End If
End Sub
Sub stick3()
dealer = Range("F22").Value
setdef = 17
dealer3:
Calculate
flagcell = Range("H4").Value
If Range(flagcell).Value = 1 Then
GoTo dealer3:
End If
Range("C3:F3").Select
Selection.Copy
Range(flagcell).Value = 1
Range("C19").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("F22").Select
dealer = Range("F22").Value
DealerStick4
ActiveCell.FormulaR1C1 = "=SUM(R[-5]C:R[-1]C)"
End Sub
Sub DealerStick4()
dealer = Range("F22").Value
setdef = 17
If dealer < setdef Then
stick4
Else
ActiveCell.FormulaR1C1 = "=SUM(R[-5]C:R[-1]C)"
End
End If
End Sub
Sub stick4()
dealer = Range("F22").Value
setdef = 17
dealer4:
Calculate
flagcell = Range("H4").Value
If Range(flagcell).Value = 1 Then
GoTo dealer4:
End If
Range("C3:F3").Select
Selection.Copy
Range(flagcell).Value = 1
Range("C20").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("F22").Select
dealer = Range("F22").Value
DealerStick5
ActiveCell.FormulaR1C1 = "=SUM(R[-5]C:R[-1]C)"
End Sub
Sub DealerStick5()
dealer5:
Calculate
flagcell = Range("H4").Value
If Range(flagcell).Value = 1 Then
GoTo dealer5:
End If
Range("C3:F3").Select
Selection.Copy
Range(flagcell).Value = 1
Range("C21").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("F22").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-5]C:R[-1]C)"
End
End Sub
-
Nov 27th, 2005, 03:39 AM
#2
Thread Starter
Addicted Member
Re: An excel card game
can't anyone help me, all i need is someon eto check it throgh as i can't find my mistake
-
Nov 27th, 2005, 11:19 AM
#3
-
Nov 27th, 2005, 12:22 PM
#4
Addicted Member
Re: An excel card game
Oh yeah, and I just quickly looked at your code and noticed that your "DealerStick3" and "DealerStick4" have an unnecessary extra "End" in it.
And you don't have to "Select" anything to do what you want to do. Your code will run more efficient and more quickly that way
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|