Hi guys, I try to filter data that I have in Macro file in DataSheet ('DS'). I need to take filtered data only (w/o header row) & copy it into different workbook/sheet 'SFDCReport', where there is a Table (Header row on line 12, 1 data row on 13).
With this code, I received some Error 1004 - sth about Overlapping..
Then I adjusted based on some advices to this code, but this one keeps copying whole data, not just the selected one..
I am a vba novice, so I copy a lot of stuff from what I find in forums & sometimes it is just hard for me to figure out where the problem is.. Thx for help, Gamca
With this code, I received some Error 1004 - sth about Overlapping..
Code:
'Filter, Select & Copy filtered data to SFDCReport table
DS.Range("A1").CurrentRegion.AutoFilter Field:=84, Criteria1:=SubRegion
Set rTable = DS.AutoFilter.Range
Set rTable = rTable.Resize(rTable.Rows.Count - 1)
Set rTable = rTable.Offset(1) 'Move new range down to start at the first data row
rTable.Copy
SFDCReport.Cells(13, 1).PasteSpecial xlPasteValues
Then I adjusted based on some advices to this code, but this one keeps copying whole data, not just the selected one..
Code:
'Filter, Select & Copy filtered data to SFDCReport table
DS.Range("A1").CurrentRegion.AutoFilter Field:=84, Criteria1:=SubRegion
LastRow = DS.AutoFilter.Range.Columns(1).SpecialCells(xlCellTypeVisible).Cells.Count - 1
LastCol = DS.AutoFilter.Range.Columns.Count
Set rTable = DS.AutoFilter.Range
Set rTable = rTable.Resize(rTable.Rows.Count - 1)
Set rTable = rTable.Offset(1) 'Move new range down to start at the first data row
Set rTable2 = SFDCReport.Range(SFDCReport.Cells(13, 1), SFDCReport.Cells(LastRow, LastCol))
rTable2.Value = rTable.Value
I am a vba novice, so I copy a lot of stuff from what I find in forums & sometimes it is just hard for me to figure out where the problem is.. Thx for help, Gamca