Slow running code for copy paste

zakynthos

Board Regular
Joined
Mar 28, 2011
Messages
169
I know there's a way to avoid using the cliopboard by 'select.copy select paste' and for some reason this code is taking a long time to execute. How could I modify it to speed up the process? Many thanks:)

Application.ScreenUpdating = False
Sheets("Exception List - Permanent").Select
Range("B2:B1000").Select
Selection.Copy

Sheets("Exclusion list").Select
Range("A2").Select

ActiveSheet.Paste

Sheets("Exception List - Permanent").Select
Application.CutCopyMode = False
Range("C2:C1000").Select
Selection.Copy

Sheets("Exclusion list").Select
Range("c2").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I'm guessing it's all the selecting that's slowing it down...

Try

Code:
Dim S1 As Worksheet, S2 As Worksheet
 
Set S1 = Sheets("Exception List - Permanent")
Set S2 = Sheets("Exclusion list")
 
Application.ScreenUpdating = False
 
S1.Range("B2:B1000").Copy Destination:=S2.Range("A2")
S1.Range("C2:C1000").Copy Destination:=S2.Range("c2")
 
Application.ScreenUpdating = True
 
Upvote 0
Thanks very much for this - it has sped up considerably!

Hope you don't mind one last question - I have some more data in another workbook and that also runs slowly with copy and paste - so if the data to be copied was in another workbook called 'Briefing ID Tracking' rather than on another tab in the same worksheet, what could be the code to access this data?
 
Upvote 0
Glad to help, thanks for the feedback..

If the other book is already open, then you can just change this
Set S1 = Sheets("Exception List - Permanent")
to
Set S1 = WorkBooks("OtherBookName.xls").Sheets("SheetNameinotherbook")
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

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