PC Review


Reply
Thread Tools Rate Thread

another "if" "then" question

 
 
jnsaunders
Guest
Posts: n/a
 
      2nd Jun 2006
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


 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      2nd Jun 2006
Have a look in vba help index for case and then select case.

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"jnsaunders" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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
>



 
Reply With Quote
 
jnsaunders
Guest
Posts: n/a
 
      2nd Jun 2006
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.

"jnsaunders" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      2nd Jun 2006
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)

"jnsaunders" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.
>
> "jnsaunders" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> >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
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
ReVIEW (Erratum): some shortcut keys not working anymore-----help""""""""PhpApach...WORK WELL!!!! wbrowse@gmail.com Windows XP Help 0 13th Apr 2007 12:29 PM
<FORM METHOD="post" onSubmit="return fieldcheck()" name="orientation" action="http://ws-kitty.BU.edu/AT/survey/orientation/script/write.asp" language="JavaScript"> Joeyej Microsoft ASP .NET 0 4th Jun 2004 08:55 PM
Manual "Windows Update" produces "ActiveX/active scripting" error message even with "LOW" security level setting in "Trusted" Zone Ray2 Windows XP Help 1 14th Nov 2003 06:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:19 AM.