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
<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>
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: