another "if" "then" question

  • Thread starter Thread starter jnsaunders
  • Start date Start date
J

jnsaunders

I would like a micro to evaluate say cell B7

If B7 has a value of 1 Macro A is invoked
If B7 has a value of 2 Macro B is invoked
If B7 has a value of 3 Macro C is invoked

I do I accomplish this?

Thx
 
Have a look in vba help index for case and then select case.
 
Function Bonus(performance, salary)
Select Case performance
Case 1
Bonus = salary * 0.1
Case 2, 3
Bonus = salary * 0.09
Case 4 To 6
Bonus = salary * 0.07
Case Is > 8
Bonus = 100
Case Else
Bonus = 0
End Select
End Function
Presumably performance is a range with numeric value that is being
evaluated? I am confused how to do this.
 
performance can be a value , 1,2,3 , etc., or a cell reference containing
that value. Diito salary.

So it can be

=Bonus(1,1000)

or

=Bonus(a1,A2)

or a mix of them

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

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

Back
Top