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
1
Date
Material
Material Desc
Production Line
2
16-Aug-16
1000001
Blue Coat
1
3
17-Aug-16
1000002
Yellow Hat
3
4
18-Aug-16
1000003
Red Jacket
5
5
18-Aug-16
1000004
Blue Coat
7
6
18-Aug-16
1000005
Yellow Hat
3
7
19-Aug-16
1000006
Red Jacket
2
8
20-Aug-16
1000007
Blue Coat
4
9
20-Aug-16
1000008
Yellow Hat
2
10
21-Aug-16
1000009
Red Jacket
6
11
22-Aug-16
1000010
Blue Coat
8
12
22-Aug-16
1000011
Yellow Hat
4
13
22-Aug-16
1000012
Red Jacket
2
14
23-Aug-16
1000013
Blue Coat
5
15
23-Aug-16
1000014
Blue Coat
4
16
24-Aug-16
1000015
Yellow Hat
5
17
25-Aug-16
1000016
Red Jacket
4
18
26-Aug-16
1000017
Blue Coat
5
19
27-Aug-16
1000018
Yellow Hat
3
20
27-Aug-16
1000019
Red Jacket
3
21
28-Aug-16
1000020
Blue Coat
1
22
28-Aug-16
1E+09
Yellow Hat
1

<tbody>
</tbody>
Test
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,216,030
Messages
6,128,407
Members
449,448
Latest member
Andrew Slatter

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