Jed Shields
Active Member
- Joined
- Sep 7, 2011
- Messages
- 283
- Office Version
- 365
- Platform
- Windows
Morning all,
I'm trying to filter a sheet and then copy the filtered data to another sheet. What I've got below works but it balloons the size of the workbook up to 180Mb! I'm assuming it's because I'm copying the entire columns rather than just the filtered data...?
Any thoughts on a better approach?
Cheers,
Jed
I'm trying to filter a sheet and then copy the filtered data to another sheet. What I've got below works but it balloons the size of the workbook up to 180Mb! I'm assuming it's because I'm copying the entire columns rather than just the filtered data...?
Any thoughts on a better approach?
Code:
Sub CopyTIData()
Dim LastRow As Long
LastRow = Range("AJ" & Rows.Count).End(xlUp).Row
ActiveSheet.Range("A1:BI" & LastRow).AutoFilter Field:=37, Criteria1:= _
"T&I IT"
Range("A:BI").Select
Selection.Copy
Sheets("T&I Data").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Sheets("Sheet1").Select
ActiveSheet.ShowAllData
End Sub
Cheers,
Jed