Find Maximum value in a range via macro

S

swatsp0p

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
 
B

bobbo

I think this should do it

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

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

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