![]() |
Macro - Date Filter
Ok I have a SPREADSHEET1 with a list of data that ranges from the past 15
days, 1-16-08 thru 1-31-08. I have another SPREADSHEET 2 that has data from 1-7-08 thru 1-24-08. I need a macro that finds the latest date on SPREADSHEET 2 and then deletes anything that is less than or equal to on the first SPREADSHEET 1. This leaves data in SPREADSHEET 1 as 1-25-08 thru 1-31-08. Any ideas? |
Macro - Date Filter
here's a start, assumes dates are in Column A and there are no blank lines...
Sub DateFilter() Dim lMaxDate As Long Application.Workbooks("SPREADSHEET 2").Activate Range("A1").Select lMaxDate = 0 Do While ActiveCell.Value 0 If ActiveCell.Value lMaxDate Then lMaxDate = ActiveCell.Value ActiveCell.Offset(1, 0).Select Loop Application.Workbooks("SPREADSHEET 1").Activate Range("A1").Select Do While ActiveCell.Value 0 If ActiveCell.Value <= lMaxDate Then ActiveCell.Clear ActiveCell.Offset(1, 0).Select Loop End Sub "Schwimms" wrote: Ok I have a SPREADSHEET1 with a list of data that ranges from the past 15 days, 1-16-08 thru 1-31-08. I have another SPREADSHEET 2 that has data from 1-7-08 thru 1-24-08. I need a macro that finds the latest date on SPREADSHEET 2 and then deletes anything that is less than or equal to on the first SPREADSHEET 1. This leaves data in SPREADSHEET 1 as 1-25-08 thru 1-31-08. Any ideas? |
All times are GMT +1. The time now is 08:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com