Date validation in VBA

exceluser9

Active Member
Joined
Jun 27, 2015
Messages
388
Hi Team,

I have recorded below macro i want to select previous day date and delete all the records but the date remains same when the macro was recorded, Please could you help me with the code to delete previous day records in column X1 and their associated rows

Thanks


Sheets("mastertracker").Select
Cells.Select
Range("T1").Activate
Selection.AutoFilter
Range("X1").Select
ActiveSheet.Range("$A$1:$AY$383").AutoFilter Field:=24, Operator:= _
xlFilterValues, Criteria2:=Array(2, "6/14/2019")
Cells.Select
Range(Selection, Selection.End(xlUp)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp
Range("A1").Select
 
Last edited:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try
xlFilterValues, Criteria2:=Array(2, "6/14/2019")

as

xlFilterValues, Criteria2:=Array(2, Today()-1)

untested
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,387
Members
448,956
Latest member
JPav

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