ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MIN/MAX question (https://www.excelbanter.com/excel-programming/313983-min-max-question.html)

mike

MIN/MAX question
 
How do you write a min/max formula in VB?

Within a macro I'm trying to get the minimum of two
numbers. I tried the following and got an error:

END = MIN(BEGROW +10, MAXROW)

Where BEGROW and MAXROW are calclutaed within the macro.

thanks


Bob Phillips[_6_]

MIN/MAX question
 
worksheetfunction.max(BEGROW+10,MAXROW)

--

HTH

RP

"Mike" wrote in message
...
How do you write a min/max formula in VB?

Within a macro I'm trying to get the minimum of two
numbers. I tried the following and got an error:

END = MIN(BEGROW +10, MAXROW)

Where BEGROW and MAXROW are calclutaed within the macro.

thanks




No Name

MIN/MAX question
 
Thank you so much!


-----Original Message-----
worksheetfunction.max(BEGROW+10,MAXROW)

--

HTH

RP

"Mike" wrote in

message
...
How do you write a min/max formula in VB?

Within a macro I'm trying to get the minimum of two
numbers. I tried the following and got an error:

END = MIN(BEGROW +10, MAXROW)

Where BEGROW and MAXROW are calclutaed within the

macro.

thanks



.


Tom Ogilvy

MIN/MAX question
 
Function MyMin(A, B)
if A < B then
MyMin = A
else
MyMin = B
End if
End Function


You can add error checking and so forth.
--
Regards,
Tom Ogilvy

"Mike" wrote in message
...
How do you write a min/max formula in VB?

Within a macro I'm trying to get the minimum of two
numbers. I tried the following and got an error:

END = MIN(BEGROW +10, MAXROW)

Where BEGROW and MAXROW are calclutaed within the macro.

thanks





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com