My problem is everytime i throw dice and step into yellow box, it not step into the yellow box but the step will go to the 5 step backward(G1) and not stop a while in the yellow box(refer to cell G5). This is my Vba.
Sub BoardGame()
Dim dice
Dim x
Dim total
x = 0
dice = Int((6 - 1 + 1) * Rnd + 1)
MsgBox dice
If ActiveCell.Row() <> 5 Or ActiveCell.Column() < 1 Or ActiveCell.Column() > 39 Then
MsgBox "FINISH!"
MsgBox total
Else
x = x + dice
ActiveCell.Offset(0, x).Select
End If
If ActiveCell = Range("G5") Then
ActiveCell.Offset(0, -5).Select
ElseIf ActiveCell = Range("I5") Then
ActiveCell.Offset(0, -7).Select
ElseIf ActiveCell = Range("N5") Then
ActiveCell.Offset(0, 3).Select
ElseIf ActiveCell = Range("U5") Then
ActiveCell.Offset(0, -5).Select
ElseIf ActiveCell = Range("Z5") Then
ActiveCell.Offset(0, 3).Select
ElseIf ActiveCell = Range("AF5") Then
ActiveCell.Offset(0, -7).Select
ElseIf ActiveCell = Range("AM5") Then
ActiveCell.Offset(0, -10).Select
End If
End Sub
Sub BoardGame()
Dim dice
Dim x
Dim total
x = 0
dice = Int((6 - 1 + 1) * Rnd + 1)
MsgBox dice
If ActiveCell.Row() <> 5 Or ActiveCell.Column() < 1 Or ActiveCell.Column() > 39 Then
MsgBox "FINISH!"
MsgBox total
Else
x = x + dice
ActiveCell.Offset(0, x).Select
End If
If ActiveCell = Range("G5") Then
ActiveCell.Offset(0, -5).Select
ElseIf ActiveCell = Range("I5") Then
ActiveCell.Offset(0, -7).Select
ElseIf ActiveCell = Range("N5") Then
ActiveCell.Offset(0, 3).Select
ElseIf ActiveCell = Range("U5") Then
ActiveCell.Offset(0, -5).Select
ElseIf ActiveCell = Range("Z5") Then
ActiveCell.Offset(0, 3).Select
ElseIf ActiveCell = Range("AF5") Then
ActiveCell.Offset(0, -7).Select
ElseIf ActiveCell = Range("AM5") Then
ActiveCell.Offset(0, -10).Select
End If
End Sub