VBA autofilter with multiple criteria that pastes to a new worksheet

ScottPennyworth

New Member
Joined
Mar 16, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello! I have the following dilemma. I get data in the same format as the picture below, it's important to note that the range of the list varies and the amount of different "animals" varies. The "FILL" Column is just a placeholder and is inserted to demonstrate that B and C columns can be ignored in this case.

What I'm trying to do is to create a code that filters the "ANIMAL" and pastes the whole row (A:F) into a new sheet based on the "TYPE" and "OWNER". So I'd have one sheet with only monkeys, that are pets and owned by Sally, and then one sheet with only monkey that are wild and owned by Sally, then a sheet with monkeys, pets and owned by James and so on. All the way to the last category, in this case Dog, Pet and James. The "AGE" should not be filtered but should be included in the "paste".

The most important thing to note again is that the animals change in both amount and in types, so there could be 5 types of animals on one data sheet and 25 on another so hopefully there is a way to filter that without manually having to write out the filter criteria. However the "TYPE" and "OWNER" columns only have those two options (pet/wild and Sally/Peter).

Thanks in advance!
 

Attachments

  • 1647439459091.png
    1647439459091.png
    22.1 KB · Views: 19

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

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