ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic MAX formula (https://www.excelbanter.com/excel-programming/434014-dynamic-max-formula.html)

Ludo

Dynamic MAX formula
 
Hi,

I'm looking for a way to have the MAX & MIN values of a dynamic range.

This one gives me a compile error

Range("A5").Select
ActiveCell.Formula ="=MAX("A7:A" &
selection.currentregion.rows.count)"

any help welcome
Regards,
Ludo

Andrew Taylor

Dynamic MAX formula
 
In the second line you don't need the quote before A7: it should be

ActiveCell.Formula = "=MAX(A7:A" & Selection.CurrentRegion.Rows.Count
& ")"

I suspect the formula still isn't quite doing what you want though
- maybe it should be something like:

ActiveCell.Formula = "=MAX(A7:A" & (Selection.CurrentRegion.Rows.Count
+5) & ")"



On 23 Sep, 15:41, Ludo wrote:
Hi,

I'm looking for a way to have the MAX & MIN values of a dynamic range.

This one gives me a compile error

* * Range("A5").Select
* * ActiveCell.Formula ="=MAX("A7:A" &
selection.currentregion.rows.count)"

any help welcome
Regards,
Ludo



Luke M

Dynamic MAX formula
 
Quotation marks were in the wrong place:

Range("A5").Select
ActiveCell.Formula = "=MAX(A7:A" & _
Selection.CurrentRegion.Rows.Count & ")"
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Ludo" wrote:

Hi,

I'm looking for a way to have the MAX & MIN values of a dynamic range.

This one gives me a compile error

Range("A5").Select
ActiveCell.Formula ="=MAX("A7:A" &
selection.currentregion.rows.count)"

any help welcome
Regards,
Ludo



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

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