Filter and Copy Loop macro

matman

Board Regular
Joined
May 13, 2002
Messages
60
I have a table, for simplicity lets say 10x10. Column 10 is the total of the inputs in that row.
If that total is above 0 then I want to copy that row and paste it underneath the array in row 20.

How do I write a simple code that will go through the table copying those rows and pasting them underneath?

Many thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
sub copy_data()

n = 1
pr = 20

Do Until n > 10
If Cells(n,10) > 0 then
Range(Cells(n,1),Cells(n,10)).Copy
Cells(pr,1).pastespecial xlpastevalues
pr = pr + 1
End If
n = n + 1
Loop

End Sub
 
Upvote 0
no probs...

as for rainy london - is that because you too are in London or are you simply making an assumption (albeit a correct one!) that it always rains in London?

That said, anyone got any jobs going somewhere sunny?
 
Upvote 0
Nope, I am in London as well, if there's any sunny jobs going then I'm first in the queue.
 
Upvote 0

Forum statistics

Threads
1,221,695
Messages
6,161,361
Members
451,699
Latest member
sfairbro

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