Excel Trini
New Member
- Joined
- Jun 16, 2010
- Messages
- 9
Hi,
I'm using Excel office 365.
Weekly I import data into Excel then filter out certain items based on preset criteria. I do this using auto filter and a simple macro to delete the entire row.
So for example, my import might look like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[TD]
[TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]Parts
[/TD]
[TD]Jack[/TD]
[TD]
[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]Parts[/TD]
[TD]Jack[/TD]
[TD]
[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]Service[/TD]
[TD]Jill[/TD]
[TD]
[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]Parts[/TD]
[TD]Jack[/TD]
[TD]
[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]Service[/TD]
[TD]Jill[/TD]
[TD]
[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]Sales[/TD]
[TD]Mary[/TD]
[TD]
[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]Service[/TD]
[TD]Jill[/TD]
[TD]
[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]<strike></strike>
[/TD]
[TD]Admin[/TD]
[TD]
[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]<strike></strike>
[/TD]
[TD]Jill[/TD]
[TD]
[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
[/FONT]My filters identify and delete any row with department "Parts" , any row with User "Admin", and Any item with "Stuff I exclude"
So in the data in red above would all be removed.
The code I am using works fine, except for instances where the data is imported and does not have a row with the item that I want to filter out.
For example, if for one week there are no rows with the user "Admin" then I get a runtime error 1004 - No cells were found.
I am looking for a way to skip over this error (and not have to debug - because it isn't a problem for me) and continue running the rest of the macro.
There must be a way.
Let me have your thoughts.
I'm using Excel office 365.
Weekly I import data into Excel then filter out certain items based on preset criteria. I do this using auto filter and a simple macro to delete the entire row.
So for example, my import might look like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]
Date
<strike></strike>[/TD]
[TD]
Department
<strike></strike>[/TD]
[TD]
User
<strike></strike>[/TD]
[TD]
Item
<strike></strike>[/TD]
[TD]
Units
<strike></strike>[/TD]
[/TR]
[TR]
[TD]
10-May
<strike></strike>[/TD]
[TD]
Parts
<strike></strike>[/TD]
[TD]
Jack
<strike></strike>[/TD]
[TD]
Stuff I include
<strike></strike>[/TD]
[TD]
2
<strike></strike>[/TD]
[/TR]
[TR]
[TD]
10-May
<strike></strike>[/TD]
[TD]
Service
<strike></strike>[/TD]
[TD]
Admin
<strike></strike>[/TD]
[TD]
Stuff I include
<strike></strike>[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]
9-May
<strike></strike>[/TD]
[TD]
Sales
[/TD][TD]
Mary
[/TD][TD]
Stuff I exclude
[/TD][TD]2[/TD]
[/TR]
[TR]
[TD]
8-May
<strike></strike>[/TD]
[TD]Parts
[/TD]
[TD]Jack[/TD]
[TD]
Stuff I include
<strike style="color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></strike><strike></strike>[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]
7-May
<strike></strike>[/TD]
[TD]Parts[/TD]
[TD]Jack[/TD]
[TD]
Stuff I include
<strike style="color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></strike><strike></strike>[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]
9-May
<strike></strike>[/TD]
[TD]Service[/TD]
[TD]Jill[/TD]
[TD]
Stuff I exclude
<strike></strike>[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]
10-May
<strike></strike>[/TD]
[TD]Parts[/TD]
[TD]Jack[/TD]
[TD]
Stuff I exclude
<strike style="color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></strike><strike></strike>[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]
7-May
<strike></strike>[/TD]
[TD]Service[/TD]
[TD]Jill[/TD]
[TD]
Stuff I include
<strike style="color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></strike><strike></strike>[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]
9-May
<strike></strike>[/TD]
[TD]Sales[/TD]
[TD]Mary[/TD]
[TD]
Stuff I include
<strike style="color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></strike><strike></strike>[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]
10-May
<strike></strike>[/TD]
[TD]Service[/TD]
[TD]Jill[/TD]
[TD]
Stuff I exclude
<strike></strike>[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]
8-May
<strike></strike>[/TD]
[TD]<strike></strike>
Service
<strike></strike>[/TD]
[TD]Admin[/TD]
[TD]
Stuff I include
<strike style="color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></strike><strike></strike>[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]
10-May
<strike></strike>[/TD]
[TD]<strike></strike>
Service
<strike></strike>[/TD]
[TD]Jill[/TD]
[TD]
Stuff I include
<strike style="color: rgb(34, 34, 34); font-family: Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: line-through; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"></strike><strike></strike>[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
[/FONT]My filters identify and delete any row with department "Parts" , any row with User "Admin", and Any item with "Stuff I exclude"
So in the data in red above would all be removed.
The code I am using works fine, except for instances where the data is imported and does not have a row with the item that I want to filter out.
For example, if for one week there are no rows with the user "Admin" then I get a runtime error 1004 - No cells were found.
I am looking for a way to skip over this error (and not have to debug - because it isn't a problem for me) and continue running the rest of the macro.
There must be a way.
Let me have your thoughts.