Naislou
10-02-2019, 04:16 AM
Hi,
I would like to copy and paste the filtered columns. The code that Mana gave me works well to extract all the columns but it is not extracting the filtered rows.
Can someone help me with it?
Thank you,
Anais
Sub test()
Dim wsS As Worksheet
Dim wsD As Worksheet
Dim s As String
Dim col
Dim n As Long
Set wsS = Sheets("Data")
Set wsD = Workbooks.Add(xlWBATWorksheet).Sheets(1)
s = "A,B,U,V,W,X,C,E,DA,L,G,J,BQ,BR,BS,BV,CG,N,P,AP,AQ,AS,AT,AU,BG,AV,AW,AX,AY"
For Each col In Split(s, ",")
n = n + 1
wsS.Columns(col).Rows("11:5000").Copy wsD.Cells(n)
Next
Application.DisplayAlerts = False
wsD.Parent.SaveAs ThisWorkbook.Path & "" & wsS.Cells(1).Value, xlOpenXMLWorkbook
Application.DisplayAlerts = True
End Sub
I would like to copy and paste the filtered columns. The code that Mana gave me works well to extract all the columns but it is not extracting the filtered rows.
Can someone help me with it?
Thank you,
Anais
Sub test()
Dim wsS As Worksheet
Dim wsD As Worksheet
Dim s As String
Dim col
Dim n As Long
Set wsS = Sheets("Data")
Set wsD = Workbooks.Add(xlWBATWorksheet).Sheets(1)
s = "A,B,U,V,W,X,C,E,DA,L,G,J,BQ,BR,BS,BV,CG,N,P,AP,AQ,AS,AT,AU,BG,AV,AW,AX,AY"
For Each col In Split(s, ",")
n = n + 1
wsS.Columns(col).Rows("11:5000").Copy wsD.Cells(n)
Next
Application.DisplayAlerts = False
wsD.Parent.SaveAs ThisWorkbook.Path & "" & wsS.Cells(1).Value, xlOpenXMLWorkbook
Application.DisplayAlerts = True
End Sub