#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default MIN in VBA?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default MIN in VBA?

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
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 829
Default MIN in VBA?

"Mike" wrote:
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)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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



All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"