VBA code to loop through autofilter

klutz2009

New Member
Joined
Jul 28, 2011
Messages
1
I have the following scenario:
Hypothetically Speaking,
Column A contains different types of fruits, and multiple entries of the same fruit.
I have column A autofiltered

What I need my macro to do is loop through that autofilter for each fruit, but not through every entry.
So I would like the loop to first select apple, and say 5 rows of apple data showed up I want to copy those rows to another worksheet.
The loop would then move on to the next type of fruit found in the autofilter, maybe a banana, copy it's rows and continue the process.

Thank you for all your help.
btw, this is my first post on this forum, I'm sorry If this is incorrect in anyway. I tried to go over the rules and look for answers relating to this topic, but I'm pressed on time and need assistance quickly.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
if you are familiar with writing macro you can write following these steps

-column A has the name of fruits repeated more than once with column heading "fruits" at A1
-advance filter column A for unique values and park the unique values five rows below the data for e.g A25 to A30 with A25 is the column head "fruits"
then loop through A26 to A30 and autofilter every time,copying the filtered data in some other location and removing the autofilter. can you write a code. if there is a problem post back.

But if you just want to see only the same fruit together then just sort column A.
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,172
Members
452,893
Latest member
denay

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