Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Excel VBA - Max Function - Syntax Error

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTA function causing syntax error in macro... Birmangirl Excel Worksheet Functions 4 February 6th 07 04:04 PM
Excel VB - WHERE syntax error in Access web query. [email protected] Excel Programming 1 October 20th 06 07:05 PM
Excel 2007 MS Query prompt yields Syntax error Bruce Excel Discussion (Misc queries) 0 May 26th 06 11:06 AM
MS Query import from Excel - Syntax Error EstherJ Excel Discussion (Misc queries) 1 April 24th 06 09:44 AM
Syntax Error in Excel Query for DATE field James T Excel Discussion (Misc queries) 3 August 31st 05 12:33 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"