View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Excel VBA - Max Function - Syntax Error

Hi Wayne,

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

Regards,

OssieMac


"u473" wrote:

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