ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to filter sheet and copy to another (https://www.excelbanter.com/excel-programming/274120-re-macro-filter-sheet-copy-another.html)

Tom Ogilvy

Macro to filter sheet and copy to another
 
Sub CopyData()
With Worksheets("sheet4")
.Range("A1").AutoFilter Field:=20, Criteria1:="Amended"
Set rng = .AutoFilter.Range
Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1)
Set rng1 = Intersect(rng, .Range("A:C,G:M,Q:S"))
rng1.Copy _
Destination:=Worksheets("Sheet2").Range("A1")
End With
End Sub


--
Regards,
Tom Ogilvy


"Gareth" wrote in message
...
I want to used AutoFilter to filter column T on Sheet1 for the word
'Amended'.

If there are any found, I would like to copy only certain columns to

Sheet2.

The columns are A:C, G:M, Q:S

Thanks in advance.

Gareth






All times are GMT +1. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com