Hi. I am a beginner practicing with VBA. I am assigning macros to buttons to make a tennis scoreboard.
If my cells I2 and J2 both = "40" then my ElseIf works properly.
However, when it cycles through again the debug halts at the same ElseIf statement even though both conditions are no longer true, and I just can't figure out why.
( I know that it errors out when I2 = "Adv", I haven't gotten to that part yet, but when I2 = "40" and J2 = "Adv" I would expect it to move the next ElseIf after the one it gets stuck on)
Here is my macro. Hope my first attempt at pasting BB code comes through ok.
Hi. I am a beginner practicing with VBA. I am assigning macros to buttons to make a tennis scoreboard.
If my cells I2 and J2 both = "40" then my ElseIf works properly.
However, when it cycles through again the debug halts at the same ElseIf statement even though both conditions are no longer true, and I just can't figure out why.
( I know that it errors out when I2 = "Adv", I haven't gotten to that part yet, but when I2 = "40" and J2 = "Adv" I would expect it to move the next ElseIf after the one it gets stuck on)
Here is my macro. Hope my first attempt at pasting BB code comes through ok.
Sub Player1_InGame()
Dim Current1 As String * 3
Dim Current2 As String * 3
Current1 = Worksheets("Tracker").Range("I2")
Current2 = Worksheets("Tracker").Range("J2")
If Current1 = 0 Then
Worksheets("Tracker").Range("I2") = 15
ElseIf Current1 = 15 Then
Worksheets("Tracker").Range("I2") = 30
ElseIf Current1 = 30 Then
Worksheets("Tracker").Range("I2") = 40
ElseIf Current1 = 40 And Current2 = 40 Then
Worksheets("Tracker").Range("I2") = "'Adv"
ElseIf Current1 = 40 And Current2 = "Adv" Then
Worksheets("Tracker").Range("I2") = "'Adv"
Worksheets("Tracker").Range("J2") = 40
Else
Worksheets("Tracker").Range("I2") = 0
End If
End Sub
If my cells I2 and J2 both = "40" then my ElseIf works properly.
However, when it cycles through again the debug halts at the same ElseIf statement even though both conditions are no longer true, and I just can't figure out why.
( I know that it errors out when I2 = "Adv", I haven't gotten to that part yet, but when I2 = "40" and J2 = "Adv" I would expect it to move the next ElseIf after the one it gets stuck on)
Here is my macro. Hope my first attempt at pasting BB code comes through ok.
Hi. I am a beginner practicing with VBA. I am assigning macros to buttons to make a tennis scoreboard.
If my cells I2 and J2 both = "40" then my ElseIf works properly.
However, when it cycles through again the debug halts at the same ElseIf statement even though both conditions are no longer true, and I just can't figure out why.
( I know that it errors out when I2 = "Adv", I haven't gotten to that part yet, but when I2 = "40" and J2 = "Adv" I would expect it to move the next ElseIf after the one it gets stuck on)
Here is my macro. Hope my first attempt at pasting BB code comes through ok.
Sub Player1_InGame()
Dim Current1 As String * 3
Dim Current2 As String * 3
Current1 = Worksheets("Tracker").Range("I2")
Current2 = Worksheets("Tracker").Range("J2")
If Current1 = 0 Then
Worksheets("Tracker").Range("I2") = 15
ElseIf Current1 = 15 Then
Worksheets("Tracker").Range("I2") = 30
ElseIf Current1 = 30 Then
Worksheets("Tracker").Range("I2") = 40
ElseIf Current1 = 40 And Current2 = 40 Then
Worksheets("Tracker").Range("I2") = "'Adv"
ElseIf Current1 = 40 And Current2 = "Adv" Then
Worksheets("Tracker").Range("I2") = "'Adv"
Worksheets("Tracker").Range("J2") = 40
Else
Worksheets("Tracker").Range("I2") = 0
End If
End Sub
Last edited: