MIN in VBA?

M

Mike

Hi everyone,

What is MIN in VBA?

Say you have this: PM=MIN(ab,cd) (minimum of ab and cd)

How do you write it in VBA?

Thanks,
Mike
 
C

Claus Busch

Hi Mike,

Am Thu, 20 Oct 2011 10:37:14 -0700 (PDT) schrieb Mike:

Say you have this: PM=MIN(ab,cd) (minimum of ab and cd)

How do you write it in VBA?

PM = WorksheetFunction.Min(ab, cd)


Regards
Claus Busch
 
J

joeu2004

Mike said:
What is MIN in VBA?
Say you have this: PM=MIN(ab,cd) (minimum of ab and cd)
How do you write it in VBA?

There is no Min function in VBA. You use WorksheetFunction.Min; that would
certainly make sense if you have some Ranges or arrays. But if ab and cd
are simple variables, I think the following is best:

PM = IIf(ab<=cd,ab,cd)
 

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

Top