Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Minimum/Maximum Dates in Range

In a range of selected cells, I want to find and store the minimum date in a
variable called MinDate, and the maximum date in a variable called MaxDate.
How do I do that? Thanks!
--
Steve C
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Minimum/Maximum Dates in Range

On Jun 18, 7:43 am, Steve C wrote:
In a range of selected cells, I want to find and store the minimum date in a
variable called MinDate, and the maximum date in a variable called MaxDate.
How do I do that? Thanks!
--
Steve C


Hello Steve,

You can use the Worksheet Min and Max functions on the dates. In VBA
you can assign the results to your variables like this...

MinDate = ActiveSheet.WorksheetFunction.Min("A1:A10")
MaxDate = ActiveSheet.WorksheetFunction.Max("A1:A10")

Change the range "A1:A10" to whatever you are using. To run this
another Worksheet that isn't the ActiveSheet, replace ActiveSheet
with...

Worksheets(<Sheet Name).WorksheetFuntion.Min("A1:A10")
Worksheets(<Sheet Name).WorksheetFuntion.Max("A1:A10")

Sincerely,
Leith Ross

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Minimum/Maximum Dates in Range

dim MinDate as date
dim MaxDate as date

mindate = application.min(selection)
maxdate = application.max(selection)



Steve C wrote:

In a range of selected cells, I want to find and store the minimum date in a
variable called MinDate, and the maximum date in a variable called MaxDate.
How do I do that? Thanks!
--
Steve C


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Minimum/Maximum Dates in Range

Fabulouso! Thank you both.
--
Steve C


"Dave Peterson" wrote:

dim MinDate as date
dim MaxDate as date

mindate = application.min(selection)
maxdate = application.max(selection)



Steve C wrote:

In a range of selected cells, I want to find and store the minimum date in a
variable called MinDate, and the maximum date in a variable called MaxDate.
How do I do that? Thanks!
--
Steve C


--

Dave Peterson

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
finding maximum, minimum in a range consists both Positive and Negative numbers Praveen Excel Worksheet Functions 3 May 4th 23 07:45 PM
Setting the minimum/maximum display range of a chart Babymech Excel Discussion (Misc queries) 3 March 16th 09 11:07 AM
Lookup Maximum between Range of Dates John Taylor Excel Discussion (Misc queries) 2 January 31st 08 10:58 PM
Recording maximum and minimum F[_3_] Excel Programming 17 September 9th 06 09:38 PM
Automatic formatting of minimum/maximum value in a range. Manish Kumar Excel Discussion (Misc queries) 2 March 5th 05 06:45 PM


All times are GMT +1. The time now is 05:40 PM.

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

About Us

"It's about Microsoft Excel"