VBA Date Reference Issue

Captain_Conman

Board Regular
Joined
Jun 14, 2018
Messages
54
Hello! I currently have a working macro that deletes all the rows that contain a date equal to or older than 6/1/18. However in coming weeks this date will change and I would like the macro to reference the most recent date found in a column E of a sheet called "Current" in the same workbook. This would then delete all the rows on Sheet 1 that have a date less than or equal to the most recent date that the macro references.

Hopefully my question is clear, and any help would be appreciated.

Here is my current code...

'Delete all old dates
With ActiveSheet
.AutoFilterMode = False
With Range("g1", Range("g" & Rows.Count).End(xlUp))
.AutoFilter 1, "<=6/1/18"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top