BOB? More Craps HELP

N

Nick

Hi Bob

Been spending some time on the code you sent and I think I
found some errors. Can you check the code below to see
what you think? I think it is now working according to
the correct rules...

Dim cellvalue
Sub Craps()
'Excel Craps V1.3

Application.ScreenUpdating = False
Range("B5:C1000").Select
Selection.ClearContents
Range("A4").Select

Setup:
Application.ScreenUpdating = True
[B5] = [B2]

Rollem:
If (([B5] = 2) Or ([B5] = 3) Or ([B5] = 12)) Then GoTo
CrapOut
If (([B5] = 7) Or ([B5] = 11)) Then GoTo FirstLucky
cellvalue = 0
GoTo NotWinner
End

NotWinner:
Application.ScreenUpdating = True
Application.Calculate
Repeater:
cellvalue = cellvalue + 1
If ([B2] = "7") Then GoTo SevenLose
Worksheets("Sheet1").Cells(cellvalue + 5, 2).Value =
[Sheet1!B2]
If ([B5] = [B6]) Then GoTo Winner
If ([B2] = [B5]) Then GoTo Winner
GoTo LoopAround
End

LoopAround:
GoTo Repeater
End

Winner:
Worksheets("Sheet1").Cells(cellvalue + 5, 2).Value = [B5]
Worksheets("Sheet1").Cells(cellvalue + 5, 3).Value = "Win"
Beep
Beep
Beep
Application.ScreenUpdating = True
End

SevenLose:
Worksheets("Sheet1").Cells(cellvalue + 5, 2).Value = "7"
Worksheets("Sheet1").Cells(cellvalue + 5, 3).Value = "Lose"
Application.ScreenUpdating = True
End

FirstLucky:
[C5] = "Win"
Beep
Beep
Beep
End

CrapOut:
[C5] = "Lose"

End Sub

The problem that was occuring was it would go
8
12 Win

or
5
6 Win

so I changed the coding
Winner:
Worksheets("Sheet1").Cells(cellvalue + 5, 2).Value = [B2]

to

Winner:
Worksheets("Sheet1").Cells(cellvalue + 5, 2).Value = [B5]

SOUND OK?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top