0

I need help with my code. It starts with "A workbook" and then it adds "X workbook" and copies data from "A workbook" with the filtered data. Then it unfilters data from "A workbook" and adds another " Y workbook" and copy contents from "A workbook". Then back to "A workbook"

Workbooks.Add

Workbooks.Add

Windows("A Workbook").Activate

Cells.Select

Selection.SpecialCells(xlCellTypeVisible).Select

Selection.Copy



Windows("X Workbook").Activate

Application.CutCopyMode = False

ActiveSheet.PasteSpecial

Windows("A Workbook").Activate

Range("F1").Select

ActiveSheet.ShowAllData

Columns("A:O").Select

Selection.Copy

Windows("Y Workbook").Activate

Application.CutCopyMode = False

ActiveSheet.PasteSpecial

Windows("A Workbook").Activate

1 Answers1

0

Firstly, you really need to read this

Secondly, the reason nothing is being copied is because you're cancelling the 'copy' by using Application.CutCopyMode = False before you paste. It should go afterwards, and isn't actually needed with a single line of code such as:

<your defined range>.SpecialCells(xlCellTypeVisible).Copy Sheets("X").Range("A1")