ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find Maximum value in a range via macro (https://www.excelbanter.com/excel-programming/375959-find-maximum-value-range-via-macro.html)

swatsp0p[_2_]

Find Maximum value in a range via macro
 
I am trying to find, in a macro, the maximum value in the range A6:A50 on
sheet 2 as value 'J'. I then want to place that value in the cell named
"Line" as such:
Range("LINE").Value = J.

Any ideas on how to go about this. I can't seem to find a 'maximum' object
and the 'xlmaximum' doesn't seem to fit the circumstance.

Thanks in advance,

Bruce
--
The older I get, the better I used to be.

bobbo

Find Maximum value in a range via macro
 
I think this should do it

j = worksheetfunction.max(range("A6:A50"))

Names("LINE").RefersToRange.value = j


swatsp0p wrote:
I am trying to find, in a macro, the maximum value in the range A6:A50 on
sheet 2 as value 'J'. I then want to place that value in the cell named
"Line" as such:
Range("LINE").Value = J.

Any ideas on how to go about this. I can't seem to find a 'maximum' object
and the 'xlmaximum' doesn't seem to fit the circumstance.

Thanks in advance,

Bruce
--
The older I get, the better I used to be.




All times are GMT +1. The time now is 03:12 AM.

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