Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Using WorksheetFunction.Max()

I have a worksheet where A1:A10 is a named range "Line"
and C1:C10 is named "Qty".
Each cell in "Line" has the formula =IF(ISNUMBER(Qty),ROW(),"")
The worksheet function =Max(Line) will return the highest value in the range
"Line".
When I try to use WorksheetFunction.Max(Line) in VBA, it always returns 0
(zero).
How can I correctly use the code to match the results of the worksheet
function?
Thanks very much.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Using WorksheetFunction.Max()

Try this
WorksheetFunction.Max(Range(Line))

The names on the worksheet are just strings like "A1:G7" which is not a range.

"Dave" wrote:

I have a worksheet where A1:A10 is a named range "Line"
and C1:C10 is named "Qty".
Each cell in "Line" has the formula =IF(ISNUMBER(Qty),ROW(),"")
The worksheet function =Max(Line) will return the highest value in the range
"Line".
When I try to use WorksheetFunction.Max(Line) in VBA, it always returns 0
(zero).
How can I correctly use the code to match the results of the worksheet
function?
Thanks very much.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Using WorksheetFunction.Max()

try this

WorksheetFunction.Max(range("Line"))

--


Gary


"Dave" wrote in message
...
I have a worksheet where A1:A10 is a named range "Line"
and C1:C10 is named "Qty".
Each cell in "Line" has the formula =IF(ISNUMBER(Qty),ROW(),"")
The worksheet function =Max(Line) will return the highest value in the range
"Line".
When I try to use WorksheetFunction.Max(Line) in VBA, it always returns 0
(zero).
How can I correctly use the code to match the results of the worksheet
function?
Thanks very much.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Using WorksheetFunction.Max()

Hi Dave,

WorksheetFunction.Max(Range("Line"))

Using line the way you did VBA thinks that it is a VBA variable not a named
range.



Regards,

OssieMac



"Dave" wrote:

I have a worksheet where A1:A10 is a named range "Line"
and C1:C10 is named "Qty".
Each cell in "Line" has the formula =IF(ISNUMBER(Qty),ROW(),"")
The worksheet function =Max(Line) will return the highest value in the range
"Line".
When I try to use WorksheetFunction.Max(Line) in VBA, it always returns 0
(zero).
How can I correctly use the code to match the results of the worksheet
function?
Thanks very much.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Using WorksheetFunction.Max()

I've struggled with understanding when to use quotes and when not to.
Thanks to all for the help.

"OssieMac" wrote:

Hi Dave,

WorksheetFunction.Max(Range("Line"))

Using line the way you did VBA thinks that it is a VBA variable not a named
range.



Regards,

OssieMac



"Dave" wrote:

I have a worksheet where A1:A10 is a named range "Line"
and C1:C10 is named "Qty".
Each cell in "Line" has the formula =IF(ISNUMBER(Qty),ROW(),"")
The worksheet function =Max(Line) will return the highest value in the range
"Line".
When I try to use WorksheetFunction.Max(Line) in VBA, it always returns 0
(zero).
How can I correctly use the code to match the results of the worksheet
function?
Thanks very much.

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
WorksheetFunction help Ayo Excel Discussion (Misc queries) 2 July 20th 08 10:48 PM
Worksheetfunction help Glen Mettler[_4_] Excel Programming 4 February 9th 05 11:41 PM
worksheetfunction GMet Excel Programming 2 September 27th 04 05:36 PM
Worksheetfunction Fred Smith Excel Programming 5 May 14th 04 01:11 AM
WorkSheetFunction.CountIf & WorkSheetFunction.SumIf with 2 conditions? Etien[_2_] Excel Programming 3 January 13th 04 04:07 PM


All times are GMT +1. The time now is 01:03 AM.

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"