Filter Loop

luvbite38

Active Member
Joined
Jun 25, 2008
Messages
368
Hi guys,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
I don’t know, what I am after is even possible in excel.<o:p></o:p>
<o:p> </o:p>
I want a code to apply filter on a column A and only check the first value of the filtered list and then copy the range (A1:D1) and paste it in another sheet (Name of the destination sheet is Summary). After pasting, it should return to origin sheet and uncheck the first value of Column A and check the second value and repeat the entire process. This code should loop until it does this action for the last value of the filtered list.<o:p></o:p>
<o:p> </o:p>
Hope it makes sense.<o:p></o:p>
<o:p> </o:p>
Regards,<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
<o:p> </o:p>
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi luvbite38,

If the data is filtered correctly there's no need to loop through each visible row to copy it - is this what you're after?

Regards,

Robert
 
Upvote 0
Thanks T,

I have a need to do this loop to undertake some calcs.

I am going to use that part of the code to complete another macro. I have already sorted out my master macro only stuck to do this loop now. Hope you can help pls.
 
Upvote 0
I'll try if you answer my question...
Sorry I didn’t get your question.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
I want to apply the filter on Range A1:D1 (A1:D1 contains heading)<o:p></o:p>
<o:p> </o:p>
Then uncheck the Select All box in the filter and only check the first value of the list. <o:p></o:p>
Then copy the range A2:D2 (these value will changes based on the selected value of the filtered list.<o:p></o:p>
Then paste Values in first blank row of Summary sheet.<o:p></o:p>
<o:p> </o:p>
Then go back to original sheet and uncheck the first value and select the second value available in the filtered list and repeat the entire process.<o:p></o:p>
<o:p> </o:p>
Stop the loop after last value was pasted in summary sheets and remove the filter from the original sheet<o:p></o:p>
 
Upvote 0
Sorry I didn’t get your question.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
I want to apply the filter on Range A1:D1 (A1:D1 contains heading)<o:p></o:p>
<o:p> </o:p>
Then uncheck the Select All box in the filter and only check the first value of the list. <o:p></o:p>
Then copy the range A2:D2 (these value will changes based on the selected value of the filtered list.<o:p></o:p>
Then paste Values in first blank row of Summary sheet.<o:p></o:p>
<o:p> </o:p>
Then go back to original sheet and uncheck the first value and select the second value available in the filtered list and repeat the entire process.<o:p></o:p>
<o:p> </o:p>
Stop the loop after last value was pasted in summary sheets and remove the filter from the original sheet<o:p></o:p>
Thank you very much for taking some time to sort this out for me.

I really appreciate it mate.
 
Upvote 0
Sorry as I can't understand why you can't just copy the visible, filtered result as one block I can't help you. I dare say there will be someone on the forum more learned than me will be able though.
 
Upvote 0
Thanks for your time T,

Can someone please make my weekend pleasant by sorting this out for me?

Regards,
 
Upvote 0
I'm still confused / curious...

Then copy the range A2:D2 (these value will changes based on the selected value of the filtered list)

Row 2 may or may not be visible depending on whether it meets the filter criteria or not.

What is the entire data range and how are you filtering the data?
 
Upvote 0
Thanks T,

Row 2 will always be visible but will always present values depending on the selected cell value in the column A.

In row 1, lets see I have name of the animals, so when you choose any of the animal in the list, the values in adjacent cells (B2 to D2) will present diffirent results.

In my summary sheet I have written a macro which will paste the copied range into their relevant place. I only need a macro to loop through each value of the Column A (one by one) and I will combine or perhaps slightly modify the code to meet my requirement.

At this stage, my only requirement is to have macro which some how, applies the filter to Range (A1: D1) and from top select each value one and copy and repeats the procedure for each value in the filtered list.

I hope it now makes some sense?

Once again, I am sooo greatful for all your support and concerns.

Kindest ever regards.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,671
Members
452,937
Latest member
Bhg1984

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