Hi everyone, I am trying to copy specific columns from the active sheet, create a new workbook and paste the specific columns into the new workbook. However, my issue is that I manage to create a new workbook but was unable to copy the columns and paste. I need some help in this, much appreciated. My code is as below
Sub copy columns()
Dim lastrow as long
dim erow as long
Workbooks.add
Last row = activesheet.select - cells(rows.count, 1).end(xlup).row
for I = 1 to lastrow
Activesheet.select.cells(i, 1).copy
erow=sheet1.cells(rows.count, 1).end(xlup).offset(1,0).row
Activesheet.select.paste destination:=worksheets("sheet1").activate.cells(erow,1)
Activesheet.select.cells(i, 2).copy
Activesheet.select.paste destination:=worksheets("sheet1").activate.cells(erow,2)
Activesheet.select.cells(i, 9).copy
Activesheet.select.paste destination:=worksheets("sheet1")activate.cells(erow,3)
Next i
Application.cutcopymode = false
range("A1").select
End sub
Sub copy columns()
Dim lastrow as long
dim erow as long
Workbooks.add
Last row = activesheet.select - cells(rows.count, 1).end(xlup).row
for I = 1 to lastrow
Activesheet.select.cells(i, 1).copy
erow=sheet1.cells(rows.count, 1).end(xlup).offset(1,0).row
Activesheet.select.paste destination:=worksheets("sheet1").activate.cells(erow,1)
Activesheet.select.cells(i, 2).copy
Activesheet.select.paste destination:=worksheets("sheet1").activate.cells(erow,2)
Activesheet.select.cells(i, 9).copy
Activesheet.select.paste destination:=worksheets("sheet1")activate.cells(erow,3)
Next i
Application.cutcopymode = false
range("A1").select
End sub