Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default define max in range (macro)

I want to define a constant in my macro to be the max value in column D from
row 2 to the last row. I'm sure this is an easy one but can't come up with
the code.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default define max in range (macro)

Sorry...didn't mean to post twice. I got an error message on the other one
that there was a connection error.

"Steve" wrote:

I want to define a constant in my macro to be the max value in column D from
row 2 to the last row. I'm sure this is an easy one but can't come up with
the code.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default define max in range (macro)

Hi,

MaxVal = WorksheetFunction.Max(Range("D2:D" & Cells(Rows.Count,
"D").End(xlUp).Row))

Mike

"Steve" wrote:

I want to define a constant in my macro to be the max value in column D from
row 2 to the last row. I'm sure this is an easy one but can't come up with
the code.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default define max in range (macro)

Yes!
"Mike H" ...
Hi,

MaxVal = WorksheetFunction.Max(Range("D2:D" & Cells(Rows.Count,
"D").End(xlUp).Row))

Mike

"Steve" wrote:

I want to define a constant in my macro to be the max value in column D
from
row 2 to the last row. I'm sure this is an easy one but can't come up
with
the code.



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
Define a range jlclyde Excel Discussion (Misc queries) 2 April 17th 08 08:26 PM
Index to define a range Boris Excel Worksheet Functions 2 July 3rd 07 02:30 PM
Define a range of cells in VBA Noemi Excel Discussion (Misc queries) 2 October 20th 05 04:32 AM
Macro - define cell range for a sum function Fad Excel Discussion (Misc queries) 2 June 6th 05 12:40 PM
Define a range based on another named range Basil Excel Worksheet Functions 2 February 21st 05 01:47 PM


All times are GMT +1. The time now is 08:11 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"