VBA Copy and paste values of filtered rows

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
4,527
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
I need some help get from Table 1 to Table 2 then Results please


Book1
ABCDEFGHIJKLM
1Table 1Table 2456Results
2123161718161718
3456Y192021192021
4789Y222324222324
5101112252627252627
6131415Y282930282930
Sheet1



Book1
ABCDEFGHIJKLM
1Table 1Table 2789Results
2123323436161718
3456Y384042192021
4789Y444648222324
5101112505254252627
6131415Y565860282930
7323436
8384042
9444648
10505254
11565860
Sheet1


Table 1 is just numbers with a filter column D.
What I need is to put the filtered cells A3:C3, A4:C4 & A6:C6 (with "Y" in Col D) in turn onto F1:H1.
Table 2 (F2:H6) is depending on F1:H1.
For each of the 3 sets of Nos in F1:H1 will produce a set of resutlts.

And I would like to get the 3 sets of results on the final table.

any pointers would be much appreciated
 
Last edited:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I need some help get from Table 1 to Table 2 then Results please


Table 1 is just numbers with a filter column D.
What I need is to put the filtered cells A3:C3, A4:C4 & A6:C6 (with "Y" in Col D) in turn onto F1:H1.
Table 2 (F2:H6) is depending on F1:H1.
For each of the 3 sets of Nos in F1:H1 will produce a set of resutlts.

And I would like to get the 3 sets of results on the final table.

any pointers would be much appreciated

Try this:

Code:
Sub Copy_Values()
    Dim c As Range
    For Each c In Range("A2", Range("A" & Rows.Count).End(xlUp))
        If Cells(c.Row, "D").Value = "Y" Then
            Range("F1").Resize(1, 3).Value = c.Resize(1, 3).Value
            Range("F2:H6").Copy
            Range("K" & Rows.Count).End(xlUp)(2).PasteSpecial xlValues
        End If
    Next
End Sub
 
Last edited:
Upvote 0
cheers, will give it a try
 
Upvote 0
that works, thanks.
but I actually simplified the problem as before the results table 2 needed to passed on to table 3 (similar to table 1 to table 2), is it possible to modify the code for that?


Book1
ABCDEFGHIJKLMNOPQ
1Table 1Table 2456Table 3192021Results
2123161718303132333435
3456Y192021333435363738
4789Y222324363738424344
5101112252627394041
6131415Y282930424344
Sheet1
 
Upvote 0
that works, thanks.
but I actually simplified the problem as before the results table 2 needed to passed on to table 3 (similar to table 1 to table 2), is it possible to modify the code for that?


Book1
ABCDEFGHIJKLMNOPQ
1Table 1Table 2456Table 3192021Results
2123161718303132333435
3456Y192021333435363738
4789Y222324363738424344
5101112252627394041
6131415Y282930424344
Sheet1

i think i found the way, testing it now.
thanks anyway
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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