Hi,
I am new to the forum and decently new to VBA so if this is an easy solution or there are other answers available sorry in advance. I have a fairly large workbook that serves as a sort of action list that is built from user input on a separate sheet. There is the possibility that someone inputs the same action for the same work center on two different dates and I would like to loop through to delete any entry that is not the oldest one. Here is a small sample of what the action list will look like:
[TABLE="width: 767"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Work Center[/TD]
[TD]Responsible[/TD]
[TD]Action[/TD]
[TD]Due[/TD]
[TD]Submitted By[/TD]
[TD]Comment[/TD]
[TD]Submitted On[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]A[/TD]
[TD]15-Apr[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]B[/TD]
[TD]15-Apr[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]C[/TD]
[TD]15-May[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]D[/TD]
[TD]15-May[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]E[/TD]
[TD]15-Jun[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]F[/TD]
[TD]15-Jun[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]G[/TD]
[TD]15-Jul[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]JW[/TD]
[TD]D[/TD]
[TD]20-May[/TD]
[TD]DA[/TD]
[TD]None[/TD]
[TD]20-Apr[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]JW[/TD]
[TD]F[/TD]
[TD]20-May[/TD]
[TD]DA[/TD]
[TD]None[/TD]
[TD]20-Apr[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]G[/TD]
[TD]20-Jun[/TD]
[TD]DA[/TD]
[TD]None[/TD]
[TD]20-Apr[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]H[/TD]
[TD]20-Jun[/TD]
[TD]DA[/TD]
[TD]None[/TD]
[TD]20-Apr[/TD]
[/TR]
</tbody>[/TABLE]
Sorry for the format like I said I am new and am not sure what the accepted way of posting table data is.
In reality there are about 250 work centers and 20 different actions that could possibly be assigned, so this is a very small snippet. The key columns are only work center, action, and submitted on. The criteria for removal is this: if the work center has that same action assigned at a previous date, then the most recent entry should be deleted. For this data set that would remove the second to last line since work center 12 had already been assigned action G on March 15th.
I am new to the forum and decently new to VBA so if this is an easy solution or there are other answers available sorry in advance. I have a fairly large workbook that serves as a sort of action list that is built from user input on a separate sheet. There is the possibility that someone inputs the same action for the same work center on two different dates and I would like to loop through to delete any entry that is not the oldest one. Here is a small sample of what the action list will look like:
[TABLE="width: 767"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Work Center[/TD]
[TD]Responsible[/TD]
[TD]Action[/TD]
[TD]Due[/TD]
[TD]Submitted By[/TD]
[TD]Comment[/TD]
[TD]Submitted On[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]A[/TD]
[TD]15-Apr[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]B[/TD]
[TD]15-Apr[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]C[/TD]
[TD]15-May[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]D[/TD]
[TD]15-May[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]E[/TD]
[TD]15-Jun[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]F[/TD]
[TD]15-Jun[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]G[/TD]
[TD]15-Jul[/TD]
[TD]RW[/TD]
[TD]None[/TD]
[TD]15-Mar[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]JW[/TD]
[TD]D[/TD]
[TD]20-May[/TD]
[TD]DA[/TD]
[TD]None[/TD]
[TD]20-Apr[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]JW[/TD]
[TD]F[/TD]
[TD]20-May[/TD]
[TD]DA[/TD]
[TD]None[/TD]
[TD]20-Apr[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]G[/TD]
[TD]20-Jun[/TD]
[TD]DA[/TD]
[TD]None[/TD]
[TD]20-Apr[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DT[/TD]
[TD]H[/TD]
[TD]20-Jun[/TD]
[TD]DA[/TD]
[TD]None[/TD]
[TD]20-Apr[/TD]
[/TR]
</tbody>[/TABLE]
Sorry for the format like I said I am new and am not sure what the accepted way of posting table data is.
In reality there are about 250 work centers and 20 different actions that could possibly be assigned, so this is a very small snippet. The key columns are only work center, action, and submitted on. The criteria for removal is this: if the work center has that same action assigned at a previous date, then the most recent entry should be deleted. For this data set that would remove the second to last line since work center 12 had already been assigned action G on March 15th.