Excel VBA - Max Function - Syntax Error

U

u473

I cannot find the proper syntax for this Max Function
Assume the current Row# is 20. I want to populate H20 with the
Max(I20,M20,O20)
I have an Error whether I reverse the order of Columns-Rows reference
or not, but I am still in learning mode.
Dim LastRow As Long, ShNextRow As Long, Fcst As Long
With ActiveSheet
For ShNextRow = 10 To LastRow
Fcst = WorksheetFunction.Max(Range("I" & ShNextRow, "M" &
ShNextRow, "O" & ShNextRow))
.Range("H" & ShNextRow) = Fcst
Next ShNextRow
End With
Your help will be appreciated,
Wayne
 
G

Guest

Hi Wayne,

Fcst = WorksheetFunction.Max(Cells(ShNextRow, "I"), _
Cells(ShNextRow, "M"), Cells(ShNextRow, "O"))

Regards,

OssieMac
 

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