Hello,
I am having some problems trying to find the mistake I am making with the following code. I wrote this code to filter some data in field 13 copy that data and paste it into a a sheet called Brokered trades and then go back to today`s sheet and filter on field 12 and delete this criteria. With the remaining data I want to copy what is left and paste to brokered trades also.
I have this code split here into two sections Section 1 is giving me the problem on line 'ActiveCell.Offset(1, 0).Paste .
Section 2 is a replica of the first part of the code and works fine. Any pointers would be greatly appreciated
Dim lastrow As Integer
Dim RNG As Range
Dim Numb_row As Integer
Dim RNGA As Range
Dim RNGA1 As Range
Dim sheetname As String
SECTION 1
Application.ScreenUpdating = False
Application.CutCopyMode = False
lastrow = Range("L1").End(xlDown).Row
sheetname = Format(Date, "mmmdd")
Sheets(sheetname).Range("A1:Q" & lastrow).Select
'Selection.AutoFilter
'Selection.AutoFilter Field:=13, Criteria1:="OSE", Operator:=xlAnd
'Set RNGA = Sheets(sheetname).Range("A1:Q" & Range("Q" & Rows.Count).End(xlUp).Row)
'Sheets(sheetname).Range("A1:Q" & lastrow).Offset(1, 0).Copy
'Selection.AutoFilter
'Sheets("brokered trades").Select
'Cells(Rows.Count, 1).End(xlUp).Select
'ActiveCell.Offset(1, 0).Paste
Section 2
Sheets(sheetname).Range("A1:Q" & lastrow).Select
Selection.AutoFilter
Selection.AutoFilter Field:=12, Criteria1:="JPY", Operator:=xlAnd
Selection.Offset(1, 0).Delete Shift:=xlUp
Selection.AutoFilter Field:=12, Criteria1:="AUD", Operator:=xlAnd
Selection.Offset(1, 0).Delete Shift:=xlUp
Selection.AutoFilter Field:=12, Criteria1:="ZAR", Operator:=xlAnd
Selection.Offset(1, 0).Delete Shift:=xlUp
Selection.AutoFilter Field:=12, Criteria1:="CNY", Operator:=xlAnd
Selection.Offset(1, 0).Delete Shift:=xlUp
Selection.AutoFilter Field:=12, Criteria1:="NZD", Operator:=xlAnd
Selection.Offset(1, 0).Delete Shift:=xlUp
Selection.AutoFilter
Set RNG = Sheets(sheetname).Range("L1:L" & Range("L" & Rows.Count).End(xlUp).Row)
Numb_row = RNG.SpecialCells(xlVisible).Count - 1
MsgBox "Count " & Numb_row & " broker trades to check"
Set RNGA1 = Sheets(sheetname).Range("A1:Q" & Range("Q" & Rows.Count).End(xlUp).Row)
Sheets(sheetname).Range("A1:Q" & lastrow).SpecialCells(xlCellTypeVisible).Offset(1, 0).Copy
Sheets("brokered trades").Select
Cells(Rows.Count, 1).End(xlUp).Select
ActiveCell.Offset(1, 0).PasteSpecial
Columns("A:Q").EntireColumn.AutoFit