P
Preschool Mike
I need some help writing this code correctly. I want it to check each If
statment but it obviously stops after the first. How can I correctly write
this so all of them are ran? I'd like it to work as follows: If the first
If statement is true then RightOrder runs, if not true then WrongOrder runs.
Then it should proceed to the next If statement and checks those conditions
and so on.
Sub MoveBlocksTo(theAnswerBox As Shape)
MyBlockAnswers.Fill.ForeColor.RGB = vbYellow
MyBlockAnswers.Top = theAnswerBox.Top + 15
MyBlockAnswers.Left = theAnswerBox.Left + 15
If MyBlockAnswers.Name = "Block1" And theAnswerBox.Name = "Block1Box" Then
RightOrder
Else
WrongOrder
End If
If MyBlockAnswers.Name = "Block2" And theAnswerBox.Name = "Block2Box" Then
RightOrder
Else
WrongOrder
End If
If MyBlockAnswers.Name = "Block3" And theAnswerBox.Name = "Block3Box" Then
RightOrder
Else
WrongOrder
End If
If MyBlockAnswers.Name = "Block4" And theAnswerBox.Name = "Block4Box" Then
RightOrder
Else
WrongOrder
End If
If MyBlockAnswers.Name = "Block5" And theAnswerBox.Name = "Block5Box" Then
RightOrder
Else
WrongOrder
End If
End If
End Sub
Thanks,
Mike
statment but it obviously stops after the first. How can I correctly write
this so all of them are ran? I'd like it to work as follows: If the first
If statement is true then RightOrder runs, if not true then WrongOrder runs.
Then it should proceed to the next If statement and checks those conditions
and so on.
Sub MoveBlocksTo(theAnswerBox As Shape)
MyBlockAnswers.Fill.ForeColor.RGB = vbYellow
MyBlockAnswers.Top = theAnswerBox.Top + 15
MyBlockAnswers.Left = theAnswerBox.Left + 15
If MyBlockAnswers.Name = "Block1" And theAnswerBox.Name = "Block1Box" Then
RightOrder
Else
WrongOrder
End If
If MyBlockAnswers.Name = "Block2" And theAnswerBox.Name = "Block2Box" Then
RightOrder
Else
WrongOrder
End If
If MyBlockAnswers.Name = "Block3" And theAnswerBox.Name = "Block3Box" Then
RightOrder
Else
WrongOrder
End If
If MyBlockAnswers.Name = "Block4" And theAnswerBox.Name = "Block4Box" Then
RightOrder
Else
WrongOrder
End If
If MyBlockAnswers.Name = "Block5" And theAnswerBox.Name = "Block5Box" Then
RightOrder
Else
WrongOrder
End If
End If
End Sub
Thanks,
Mike