Paste special code to be modified..

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
I want this line of code modify bit..
copy and paste as a paste special values..How do ​I make this..
Range("A3", Range("A3").End(xlDown)).Copy Range("AA3")
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Yes, I know that. But the line of code I have get it from mrexcel only. So wanted to see how can use in this scenario. Thanks for reply..
 
Upvote 0
Ok show us the code from the macro recorder and ill explain it.

Hi, Thanks again for reply. Here is the macro recorder..
Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("AA3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
 
Upvote 0
So you can simplify that down a bit as you rarely need to select anything. Taking your first two lines:

Code:
Range("A3").Select
    Range(Selection, Selection.End(xlDown)).Select

The selection is Range("A3") so we can replace selection by Range("A3")

Also we dont need to select our new range to copy it so:

Code:
Range("A3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy

can be simplified down to the one liner:

Code:
Range(Range("A3"), Range("A3").End(xlDown)).Copy

To paste special is the same:

Code:
Range("AA3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Range("AA3") is the selection so:

Code:
Range("AA3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
 
Upvote 0
Hey, Thanks Really. This helps. I didn't think in that way before.

So you can simplify that down a bit as you rarely need to select anything. Taking your first two lines:

Code:
Range("A3").Select
    Range(Selection, Selection.End(xlDown)).Select

The selection is Range("A3") so we can replace selection by Range("A3")

Also we dont need to select our new range to copy it so:

Code:
Range("A3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy

can be simplified down to the one liner:

Code:
Range(Range("A3"), Range("A3").End(xlDown)).Copy

To paste special is the same:

Code:
Range("AA3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Range("AA3") is the selection so:

Code:
Range("AA3").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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