Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Get max & min dates from column

Column "D" has random date values in cells
I need to retrieve the min and max dates from this column and store values
in a varible.
I have tried the following:
Dim d1 As Date
Application.Min (Application.Index(d1, 0, 4)) '4=column D
This just returns a time stamp

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Get max & min dates from column

Try,

mydatemax = Format(WorksheetFunction.Max(Range("a1:a10")), "dd mm yyyy")
mydatemin = Format(WorksheetFunction.Min(Range("a1:a10")), "dd mm yyyy")


Mike
"miek" wrote:

Column "D" has random date values in cells
I need to retrieve the min and max dates from this column and store values
in a varible.
I have tried the following:
Dim d1 As Date
Application.Min (Application.Index(d1, 0, 4)) '4=column D
This just returns a time stamp

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Get max & min dates from column

With dates in column D:

Sub dated()
x = Application.WorksheetFunction.Max(Range("D:D"))
MsgBox (Format(x, "mm/dd/yyyy"))
End Sub

and similar for the min. This is because Dates are really just numbers with
a fancy format!
--
Gary''s Student - gsnu200781


"miek" wrote:

Column "D" has random date values in cells
I need to retrieve the min and max dates from this column and store values
in a varible.
I have tried the following:
Dim d1 As Date
Application.Min (Application.Index(d1, 0, 4)) '4=column D
This just returns a time stamp

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Get max & min dates from column

Thanks This worked fine.
I used: d1 = Format(WorksheetFunction.Max(Range("d:d")), "mm/dd/yyyy")

"Mike H" wrote:

Try,

mydatemax = Format(WorksheetFunction.Max(Range("a1:a10")), "dd mm yyyy")
mydatemin = Format(WorksheetFunction.Min(Range("a1:a10")), "dd mm yyyy")


Mike
"miek" wrote:

Column "D" has random date values in cells
I need to retrieve the min and max dates from this column and store values
in a varible.
I have tried the following:
Dim d1 As Date
Application.Min (Application.Index(d1, 0, 4)) '4=column D
This just returns a time stamp

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Get max & min dates from column

Thanks This worked fine.
I used: d1 = Format(WorksheetFunction.Max(Range("d:d")), "mm/dd/yyyy")


"Gary''s Student" wrote:

With dates in column D:

Sub dated()
x = Application.WorksheetFunction.Max(Range("D:D"))
MsgBox (Format(x, "mm/dd/yyyy"))
End Sub

and similar for the min. This is because Dates are really just numbers with
a fancy format!
--
Gary''s Student - gsnu200781


"miek" wrote:

Column "D" has random date values in cells
I need to retrieve the min and max dates from this column and store values
in a varible.
I have tried the following:
Dim d1 As Date
Application.Min (Application.Index(d1, 0, 4)) '4=column D
This just returns a time stamp

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
How can I convert column of dates to Hebrew dates Joe Golden Excel Discussion (Misc queries) 11 May 14th 23 07:45 PM
how do I sort a column of random dates into Consecutive dates Rob Gibson Excel Worksheet Functions 2 June 12th 07 05:10 AM
How to count dates in a column between 2 dates deaconj999 Excel Programming 6 April 15th 07 08:54 PM
How do I sum #s in a column based on dates in another column prgmme Excel Discussion (Misc queries) 3 August 21st 06 06:29 PM
Formula help for counting,with a column of dates and a column of n Altstatten Excel Worksheet Functions 2 December 8th 05 09:32 PM


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