Hello everyone,
I am working with history logs that have been imported from text files into excel. There will be several hundred of them, each fitting in one column, but of variable length. I am attempting to extract the last recorded date from the log, which is always of the number format */*/???? and then paste in onto another worksheet.
Unfortunately, the last date is not necessarily the latest date on the record, so a MAX function will not work, nor have I been able to get a MATCH function to work, as there are other dates within a single column.
I wrote a clumsy macro to handle it for the time being, but it essentially just an automation of using the "find" feature, and takes a long time when searching through hundreds of columns.
If anyone has any thoughts about a more elegant way to handle this, I would be really appreciative.
I am working with history logs that have been imported from text files into excel. There will be several hundred of them, each fitting in one column, but of variable length. I am attempting to extract the last recorded date from the log, which is always of the number format */*/???? and then paste in onto another worksheet.
Unfortunately, the last date is not necessarily the latest date on the record, so a MAX function will not work, nor have I been able to get a MATCH function to work, as there are other dates within a single column.
I wrote a clumsy macro to handle it for the time being, but it essentially just an automation of using the "find" feature, and takes a long time when searching through hundreds of columns.
Code:
'Manually find and fill in End dates
Sheets("Dynamic Summary").Select
Range("B3").Select
Sheets("Log Data").Select
Range("A1").Select
If Selection.Offset(0, 1).Value = Empty Then
Selection.End(xlDown).Select
Cells.Find(What:="*/*/????", after:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, _
MatchCase:=False, SearchFormat:=False).Select
Selection.Copy
Sheets("Dynamic Summary").Select
ActiveSheet.Paste
Else
Selection.End(xlToRight).Value = "END"
Do
Selection.End(xlDown).Select
Cells.Find(What:="*/*/????", after:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, _
MatchCase:=False, SearchFormat:=False).Select
Selection.Copy
Sheets("Dynamic Summary").Select
ActiveSheet.Paste
ActiveCell.Offset(0, 1).Select
Sheets("Log Data").Select
Selection.End(xlUp).Select
ActiveCell.Offset(0, 1).Select
Loop Until Selection = "END"
Selection.ClearContents
End If