VBA Speed up copy/paste by not using clipboard HELP

Pippity

New Member
Joined
Mar 22, 2016
Messages
1
Hi,

I am trying to speed up a macro i have which does lots of copy paste functions after some calculations have been completed.

I tried this:
Code:
[INDENT]OutputRow = 3 + ((Modelpoint - 1) * 126)[/INDENT]
        Sheets("ENGINE").Range("A348:DZ473").Value = Sheets("Output").Cells(OutputRow, 1).Value

Modelpoint being a loop that goes through various rows..

I only want values but it deleted all the formulas in the engine sheet that was was trying to copy.

This was my starting point:
Code:
[INDENT] Sheets("ENGINE").Activate[/INDENT]
        OutputRow = 3 + ((Modelpoint - 1) * 3)
        Range("A348:DZ473").Select
        Selection.Copy
        Sheets("Output").Activate
        Sheets("Output").Cells(OutputRow, 5).Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, skipBlanks:=False, Transpose:=False
        Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, skipBlanks:=False, Transpose:=False

My macro takes about 20mins to run as I have 3 different parts from the engine that i paste into output sheets.
I think if i can avoid the clipboard I may be able to improve the speed a lot.

Thanks for your help
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
i'm not sure how you can bypass the clipboard... however you can modify your code to speed things up. There is no need to select ranges to copy/paste them. See below:

Code:
Sheets("ENGINE").Activate
OutputRow = 3 + ((Modelpoint - 1) * 3)
Range("A348:DZ473").Copy
With Sheets("Output").Cells(OutputRow, 5)
    .PasteSpecial Paste:=xlPasteValues
    .PasteSpecial Paste:=xlPasteFormats
End With

Also make sure you have turned off screen updating.
Code:
Application.ScreenUpdating = False
'All your code here.
Application.ScreenUpdating = True

Hope that helps a bit
Caleeco
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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