View Full Version : Copy Paste hide columns of Filtered data

03-11-2015, 11:48 PM
Column D is hidden, hidden columns are unable to copy and paste the filter. But it will unhide column D works. I hope to respond to hide.

Sub FilterValues()
'Filter TP & IL
Application.ScreenUpdating = False
If Sheets("Sheet1").AutoFilterMode = True Then Sheets("Sheet1").AutoFilterMode = False
Sheets("Sheet1").Range("A3:D" & Cells(Rows.Count, "A").End(xlUp).Row).AutoFilter Field:=1, Criteria1:=Array("IL", "TP"), Operator:=xlFilterValues
Range("D4:D" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(xlCellTypeVisible).Select
Selection.EntireColumn.Hidden = True
With Sheets("Sheet2").Range("B4")
.PasteSpecial xlPasteValues
End With
Application.CutCopyMode = False
Sheets("Sheet1").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub