Vba code take so much time to copy and paste

getsomex

New Member
Joined
May 9, 2019
Messages
1
hello I am trying to copy columns one sheet to another however it takes so much time to copy.
i have tried this code below. I have lots of data it takes several time with this code. any tips to make this code more efficient?


Code:
Dim lastrow, erow As Long
lastrow = Worksheets("sheet 2").Cells(Rows.Count, 
1).End(xlUp).Row


For i = 2 To lastrow

Worksheets("sheet 1").Cells(i, 1).Copy

erow = Worksheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Row

 Worksheets("sheet 1").Paste Destination:=Worksheets("sheet2").Cells(erow + 
  1, 1)

  Worksheets("sheet 1").Cells(i, 3).Copy

  Worksheets("sheet 1").Paste Destination:=Worksheets("sheet2").Cells(erow + 
  1,  3)


   Next i
  Application.CutCopyMode = False
Worksheets("Sheet1").Cells(1, 1).Select
 
Last edited by a moderator:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Welcome to the forum.

Please take a minute to read the forum rules, especially as regards cross-posting, and then update this thread with links to your post(s) in any other forum(s). Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,589
Messages
6,120,415
Members
448,960
Latest member
AKSMITH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top