Claire has attended:
Excel VBA Intro Intermediate course
If statements
How do you enter multiple if statements in VBA?
RE: If statements
Hi Claire
Thank you for your question regarding If Statements.
To use multiple Ifs in VBA you use an ElseIF. Be careful to make sure the ElseIf is one word. The syntax is very similar to the If line. You can have as many ElseIf lines inside your If statement as you like.
Example If Statement
Function Bonus(iSales As Integer, iTarget As Integer) As Integer
If iSales > iTarget Then
Bonus = 3000
ElseIf iSales = iTarget Then
Bonus = 2000
Else
Bonus = 250
End If
End Function
I hope that answers your question.
Laura GB