Deleting rows with date less than date I enter into cell

tmpollard

Board Regular
Joined
Jun 12, 2008
Messages
111
Please help with macro code to delete rows where the date is less than a date I enter into a cell. As you can see my dataset has a header row.
Currently in cell A1 is the word "Date", it is formatted as General.
In cell A1 I will enter a date such as 26-Aug-16.

I would like for a macro to add 1 day to the date I entered making it 27-Aug-16
then, scan down the rest of the sheet starting on row 2 and delete any row where the date is less than the date in cell A1(27-Aug-16).

My worksheet will probably always contain less than 100 rows of data.

Hope that made sense. Thanks


Excel 2012
A
B
C
D
Date
Material
Material Desc
Production Line
Blue Coat
Yellow Hat
Red Jacket
Blue Coat
Yellow Hat
Red Jacket
Blue Coat
Yellow Hat
Red Jacket
Blue Coat
Yellow Hat
Red Jacket
Blue Coat
Blue Coat
Yellow Hat
Red Jacket
Blue Coat
Yellow Hat
Red Jacket
Blue Coat
Yellow Hat

<tbody>
[TD="align: center"]1
[/TD]

[TD="align: center"]2
[/TD]
[TD="align: right"]16-Aug-16
[/TD]
[TD="align: right"]1000001
[/TD]

[TD="align: right"]1
[/TD]

[TD="align: center"]3
[/TD]
[TD="align: right"]17-Aug-16
[/TD]
[TD="align: right"]1000002
[/TD]

[TD="align: right"]3
[/TD]

[TD="align: center"]4
[/TD]
[TD="align: right"]18-Aug-16
[/TD]
[TD="align: right"]1000003
[/TD]

[TD="align: right"]5
[/TD]

[TD="align: center"]5
[/TD]
[TD="align: right"]18-Aug-16
[/TD]
[TD="align: right"]1000004
[/TD]

[TD="align: right"]7
[/TD]

[TD="align: center"]6
[/TD]
[TD="align: right"]18-Aug-16
[/TD]
[TD="align: right"]1000005
[/TD]

[TD="align: right"]3
[/TD]

[TD="align: center"]7
[/TD]
[TD="align: right"]19-Aug-16
[/TD]
[TD="align: right"]1000006
[/TD]

[TD="align: right"]2
[/TD]

[TD="align: center"]8
[/TD]
[TD="align: right"]20-Aug-16
[/TD]
[TD="align: right"]1000007
[/TD]

[TD="align: right"]4
[/TD]

[TD="align: center"]9
[/TD]
[TD="align: right"]20-Aug-16
[/TD]
[TD="align: right"]1000008
[/TD]

[TD="align: right"]2
[/TD]

[TD="align: center"]10
[/TD]
[TD="align: right"]21-Aug-16
[/TD]
[TD="align: right"]1000009
[/TD]

[TD="align: right"]6
[/TD]

[TD="align: center"]11
[/TD]
[TD="align: right"]22-Aug-16
[/TD]
[TD="align: right"]1000010
[/TD]

[TD="align: right"]8
[/TD]

[TD="align: center"]12
[/TD]
[TD="align: right"]22-Aug-16
[/TD]
[TD="align: right"]1000011
[/TD]

[TD="align: right"]4
[/TD]

[TD="align: center"]13
[/TD]
[TD="align: right"]22-Aug-16
[/TD]
[TD="align: right"]1000012
[/TD]

[TD="align: right"]2
[/TD]

[TD="align: center"]14
[/TD]
[TD="align: right"]23-Aug-16
[/TD]
[TD="align: right"]1000013
[/TD]

[TD="align: right"]5
[/TD]

[TD="align: center"]15
[/TD]
[TD="align: right"]23-Aug-16
[/TD]
[TD="align: right"]1000014
[/TD]

[TD="align: right"]4
[/TD]

[TD="align: center"]16
[/TD]
[TD="align: right"]24-Aug-16
[/TD]
[TD="align: right"]1000015
[/TD]

[TD="align: right"]5
[/TD]

[TD="align: center"]17
[/TD]
[TD="align: right"]25-Aug-16
[/TD]
[TD="align: right"]1000016
[/TD]

[TD="align: right"]4
[/TD]

[TD="align: center"]18
[/TD]
[TD="align: right"]26-Aug-16
[/TD]
[TD="align: right"]1000017
[/TD]

[TD="align: right"]5
[/TD]

[TD="align: center"]19
[/TD]
[TD="align: right"]27-Aug-16
[/TD]
[TD="align: right"]1000018
[/TD]

[TD="align: right"]3
[/TD]

[TD="align: center"]20
[/TD]
[TD="align: right"]27-Aug-16
[/TD]
[TD="align: right"]1000019
[/TD]

[TD="align: right"]3
[/TD]

[TD="align: center"]21
[/TD]
[TD="align: right"]28-Aug-16
[/TD]
[TD="align: right"]1000020
[/TD]

[TD="align: right"]1
[/TD]

[TD="align: center"]22
[/TD]
[TD="align: right"]28-Aug-16
[/TD]
[TD="align: right"]1E+09
[/TD]

[TD="align: right"]1
[/TD]

</tbody>
Test
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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