jevi
Active Member
- Joined
- Apr 13, 2010
- Messages
- 339
- Office Version
- 2016
- Platform
- Windows
Dear All,
I am trying to copy the data from the workbook "Report 1", sheet: "First" , only the columns "A:A,J:J,U:U,V:V,W:W,Z:Z,AG:AG,AW:AW,BB:BB"
to the Workbook "Report 2.xlsm, Sheets"All" to the A2:K
But is not working as it is copying other columns that are close to each other...what I am doing wrong with the VBA?!
Thank you,
I am trying to copy the data from the workbook "Report 1", sheet: "First" , only the columns "A:A,J:J,U:U,V:V,W:W,Z:Z,AG:AG,AW:AW,BB:BB"
to the Workbook "Report 2.xlsm, Sheets"All" to the A2:K
But is not working as it is copying other columns that are close to each other...what I am doing wrong with the VBA?!
Thank you,
VBA Code:
Sub copyCols()
Application.ScreenUpdating = False
Dim LastRow As Long
Workbooks("Report 1.xlsx").Activate
LastRow = Sheets("Report 1").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Sheets("First").Range("A:A,J:J,U:U,V:V,W:W,Z:Z,AG:AG,AW:AW,BB:BB").EntireColumn.Hidden = True
Range("A2:K" & LastRow).SpecialCells(xlCellTypeVisible).Copy Workbooks("Report 2.xlsm").Sheets("All").Cells(2, 1)
Sheets("First").Range("A:A,J:J,U:U,V:V,W:W,Z:Z,AG:AG,AW:AW,BB:BB").EntireColumn.Hidden = False
Application.ScreenUpdating = True
End Sub