I have worksheet ("Formatted Data") and worksheet("Client_1 Data")
I run Macro which do following steps:
- select worksheet("Fromatted Data")
- autoFilter data in Column "C" with value "client_1"
- copy selected columns from worksheet ("Formatted Data") and Paste data to worksheet("Client_1 Data")
What is my issue:
- macro copy not only Data i filtered but all of them, veen if they are not visible.
My Macro Code:
Sub PRINT_AVIVA_ISA()
Sheets("Formatted Data").Select
ActiveSheet.Range("$A$1:$R$73").autofilter Field:=3, Criteria1:=Array( _
"client_1"), Operator:=xlFilterValues
Dim LastRow As Long, erow As Long
LastRow = Worksheets("Formatted Data").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To LastRow
Worksheets("Formatted Data").Cells(i, 2).Copy
erow = Worksheets("Client_1 Data").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Formatted Data").Paste Destination:=Worksheets("Client_1 Data").Cells(erow + 1, 1) ' --- account number
Worksheets("Formatted Data").Cells(i, 3).Copy
Worksheets("Formatted Data").Paste Destination:=Worksheets("Client_1 Data").Cells(erow + 1, 2) ' --- designation
Worksheets("Formatted Data").Cells(i, 4).Copy
Worksheets("Formatted Data").Paste Destination:=Worksheets("Client_1 Data").Cells(erow + 1, 3) ' --- fund name
Worksheets("Formatted Data").Cells(i, 5).Copy
Worksheets("Formatted Data").Paste Destination:=Worksheets("Client_1 Data").Cells(erow + 1, 4) ' --- fund code
Worksheets("Formatted Data").Cells(i, 7).Copy
Next i
End Sub
What i need:
- put into my existing code something to copy only filtered data?
Thanks,
Peter.