MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Getting Dates

Posted by Wayne on October 07, 1999 7:07 PM


I have a spreadsheet with a list of documents including the dates they were entered. I need to create a macro that asks for a start and end date and then put those records into a new sheet in the same workbook. As default dates I want to put the earliest and latest dates. Getting the first date is easy as it is in date order but how to I get the last date in a column?


Posted by Ivan Moala on October 08, 1999 3:04 AM

Wayne try the following;

Assumes your date data is @ Range("B2")

Sub GetdateLastCol()
Dim LastDate As Date

Range(ActiveCell, ActiveCell.End(xlDown)).Select
'The send keys sends "CTRL ." to the active application
'This command selects the next corner cell in the active selection
'which is the last cell in the column.
SendKeys "^.", True
LastDate = ActiveCell
End Sub