ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   define max in range (macro) (https://www.excelbanter.com/excel-discussion-misc-queries/215550-define-max-range-macro.html)

Steve

define max in range (macro)
 
I want to define a constant in my macro to be the max value in column D from
row 2 to the last row. I'm sure this is an easy one but can't come up with
the code.

Steve

define max in range (macro)
 
Sorry...didn't mean to post twice. I got an error message on the other one
that there was a connection error.

"Steve" wrote:

I want to define a constant in my macro to be the max value in column D from
row 2 to the last row. I'm sure this is an easy one but can't come up with
the code.


Mike H

define max in range (macro)
 
Hi,

MaxVal = WorksheetFunction.Max(Range("D2:D" & Cells(Rows.Count,
"D").End(xlUp).Row))

Mike

"Steve" wrote:

I want to define a constant in my macro to be the max value in column D from
row 2 to the last row. I'm sure this is an easy one but can't come up with
the code.


Λ­ΚΗΛ­

define max in range (macro)
 
Yes!
"Mike H" ...
Hi,

MaxVal = WorksheetFunction.Max(Range("D2:D" & Cells(Rows.Count,
"D").End(xlUp).Row))

Mike

"Steve" wrote:

I want to define a constant in my macro to be the max value in column D
from
row 2 to the last row. I'm sure this is an easy one but can't come up
with
the code.





All times are GMT +1. The time now is 03:51 PM.

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