Shorter version of Copy/Paste?

EssKayKay

Active Member
Joined
Jan 5, 2003
Messages
402
Office Version
  1. 2007
Platform
  1. Windows
No biggie here just wondering if there is a shorter/more efficient way to code "copy/paste"?

VBA Code:
Range("R33:R133").Select
Selection.Copy
Range("R33").Select
Selection.PasteSpecial Paste:=xlPasteValues

Thanks for viewing,
Steve
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
If you are just trying to convert the formulas to hard-coded values, you can use:
VBA Code:
Range("R33:R133").Value = Range("R33:R133").Value
 
Upvote 0
Solution
Thank you Joe - much appreciated. I use the "long" way numerous times in my coding. I will make the change.
 
Upvote 0
You are welcome.

Also note that it is usually not necessary to select ranges in order to work with them. Doing so not only adds an extra line to your code, but also slows your code down (every select slows your code).

The Macro Recorder is very literal, and records every cell selection. Usually you can clean up your code. Most every time you have one line end with "Select" and the next line begins with "Selection", you can combine those two lines together.

So something like this:
VBA Code:
Range("R33:R133").Select
Selection.Copy
could be simplified to just this:
VBA Code:
Range("R33:R133").Copy
 
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