Dynamic MAX formula

L

Ludo

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
 
A

Andrew Taylor

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) & ")"
 
L

Luke M

Quotation marks were in the wrong place:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top