Copy Paste VBA Question

Glasgowsmile

Active Member
Joined
Apr 14, 2018
Messages
280
Office Version
  1. 365
Platform
  1. Windows
Good day,

I currently have the following code and I'm trying to find an quicker way to copy / paste it.

VBA Code:
Sheets(1).Range("A2:B2").Copy
         Sheet1.Range("$B$2").PasteSpecial xlPasteValues
         
         Sheets(1).Range("F2:G2").Copy
         Sheet1.Range("$G$2").PasteSpecial xlPasteValues
         
         Sheets(1).Range("I2:J2").Copy
         Sheet1.Range("$K$2").PasteSpecial xlPasteValues
         
         Sheets(1).Range("L2:M2").Copy
         Sheet1.Range("$O$2").PasteSpecial xlPasteValues

Is there a better way to condense this code into something quicker and more efficient?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
That should run pretty fast (you do not have any "Selects").
Since the ranges you are copying are not consecutive, and don't even seem to follow any sort of discernable pattern that could be calculated/repeated, I can't really see any way of making it more efficient or shorter.

Is there some issue with your current code ?
 
Upvote 0
That should run pretty fast (you do not have any "Selects").
Since the ranges you are copying are not consecutive, and don't even seem to follow any sort of discernable pattern that could be calculated/repeated, I can't really see any way of making it more efficient or shorter.

Is there some issue with your current code ?

No, there is no issue with it. I just wanted to see if something could be improved upon for it or if there was less lines I've have to type up.
 
Upvote 0
No, there is no issue with it. I just wanted to see if something could be improved upon for it or if there was less lines I've have to type up.
If there was a discernable pattern, maybe. But it would just be less lines to type, it really wouldn't run any faster.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,737
Messages
6,180,657
Members
452,992
Latest member
TokugawaIesuma

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