Fast method to transfer values without using clipboard?

Dobo_Bobo

New Member
Joined
Jan 24, 2018
Messages
31
I am teaching myself VBA and I have been running a certain task via Copy and PasteSpecial Paste:=xlPasteValues and it completes the macro within 7 seconds. The task is to move the values to the left by one column.

I've recently read the clipboard should be avoided when possible thus I used an alternative method which was suggested. However, I've found this method results in the macro taking 40 seconds to complete! Thus, please can someone tell me if there is another way that enables my macro to run as fast as the clipboard method, but without using the clipboard?


An extract of the alternative method is below, but please note this is just one section, there are about 200 lines of code required to transfer values.


If anyone can help I will really appreciate it and I will return to give thanks.

Code:
Sub Test()

'TRANSFER VALUES
'Team A
Worksheets("Sheet1").Range("U471:AE471").Value = Worksheets("Sheet1").Range("V471:AF471").Value
Worksheets("Sheet1").Range("U473:AE473").Value = Worksheets("Sheet1").Range("V473:AF473").Value
Worksheets("Sheet1").Range("U475:AE475").Value = Worksheets("Sheet1").Range("V475:AF475").Value

'Team B
Worksheets("Sheet1").Range("U477:AE477").Value = Worksheets("Sheet1").Range("V477:AF477").Value
Worksheets("Sheet1").Range("U479:AE479").Value = Worksheets("Sheet1").Range("V479:AF479").Value
Worksheets("Sheet1").Range("U481:AE481").Value = Worksheets("Sheet1").Range("V481:AF481").Value


'Team C
Worksheets("Sheet1").Range("U483:AE483").Value = Worksheets("Sheet1").Range("V483:AF483").Value
Worksheets("Sheet1").Range("U485:AE485").Value = Worksheets("Sheet1").Range("V485:AF485").Value
Worksheets("Sheet1").Range("U487:AE487").Value = Worksheets("Sheet1").Range("V487:AF487").Value


'Team D
Worksheets("Sheet1").Range("U489:AE489").Value = Worksheets("Sheet1").Range("V489:AF489").Value
Worksheets("Sheet1").Range("U491:AE491").Value = Worksheets("Sheet1").Range("V491:AF491").Value
Worksheets("Sheet1").Range("U493:AE493").Value = Worksheets("Sheet1").Range("V493:AF493").Value


'Team E
Worksheets("Sheet1").Range("U495:AE495").Value = Worksheets("Sheet1").Range("V495:AF495").Value
Worksheets("Sheet1").Range("U497:AE497").Value = Worksheets("Sheet1").Range("V497:AF497").Value
Worksheets("Sheet1").Range("U499:AE499").Value = Worksheets("Sheet1").Range("V499:AF499").Value

End Sub
 
Many thanks again RSpin! My work load has hit the roof but I've done an initial test and that macro speeds it up very well and easy to follow should I get hit by bus, etc. Cheers! :)
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,215,044
Messages
6,122,827
Members
449,096
Latest member
Erald

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