Copy paste special values from any location to any location.

MarieTherese

New Member
Joined
Mar 26, 2010
Messages
10
Hello lovely people,

I've had a look for an answer on this but can't find any solution flexible enough. I'm looking for a macro to replace the shortcut Ctrl + CSV. I've recorded the below code however it copies and pastes the selection in place, where as I want it to copy the selection and paste special values any where in the workbook.

Any ideas appreciated.

Sub PasteValues()
'
' PasteValues Macro
'
' Keyboard Shortcut: Ctrl+Shift+V
'
Selection.Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi Marie,

This might work for you.

Put in a standard module of the workbook you want to copy from.

Run code and follow the prompts. (You can use your mouse to select what you want to copy.)
Click OK and click on the upper left cell of where you want the copy to go, then OK.

So you can select what you want to copy and if you want to paste it on sheet 3, click on sheet 3 tab, click on the desired upper left cell and OK to paste.
Or you can stay on the same sheet to paste that you copied from to do your paste.

If you want to paste into another workbook, then uncomment this line 'Application.Goto Workbooks("Book2").Sheets("Sheet1").Range("A1")
Make sure the Book name (shown in red) is correct, that is change it in the code to your book name.

Once you have made your copy it will take you to that book as named, sheet1. Then you can select any sheet in the book to paste in.

Give it a go and post back with any question or comments.

Regards,
Howard

Code:
Option Explicit

Sub CopyToSheetorToBook()
Dim ColRngFrm As Range
Dim ColRngTo As Range

Set ColRngFrm = Application.InputBox(Prompt:="Enter a Copy from Range.", _
  Title:="Enter Copy from Column", Type:=8)
  If ColRngFrm Is Nothing Then Exit Sub

*********
'Application.Goto Workbooks("Book2").Sheets("Sheet1").Range("A1")
'*********
Set ColRngTo = Application.InputBox(Prompt:="Enter a Copy to Range.", _
  Title:="Enter Copy to Column", Type:=8)
  If ColRngTo Is Nothing Then Exit Sub

MsgBox ColRngTo.Address
ColRngFrm.Copy ColRngTo
   
End Sub
 
Upvote 0
Woops, my bad...

Change this line:

Code:
ColRngFrm.Copy ColRngTo

To this:

Code:
CpyRngFrm.Copy
CpyRngTo.PasteSpecial Paste:=xlPasteValues

Regards,
Howard
 
Upvote 0
Hey, I'm getting a 'variable not defined' message when I susbtiute your new code.
On another note if I have to go through populating input boxes it will take me longer than just tapping in ctrl + c + alt esv which i can do in my sleep I use it so often :)
 
Upvote 0
My thought also, but you did ask for a macro, didn't you?

If you are not going to use it, I won't pursue the undefined variable.

Regards,
Howred
 
Upvote 0
I did indeed ask for a macro, I have a macro to take any selection & paste special text and am looking for one to do the same only values. For me a macro does not mean you have to use input boxes. But thank you for your help.
 
Upvote 0
Hello, this just copies my selection inserts a new sheet and paste values in Row 73 Column Z, it's not a dynamic selection.
 
Upvote 0
Well you didn't say anything about it being dynamic, you just said to make it paste anywhere.
Z73 certainly qualifies as a member of anywhere.

If you already have a macro that does the copy paste as text.
Can you post that macro, it can be adjusted to do it as values.
 
Upvote 0
The title of the thread says from any location to any location if I wanted it to go to Z73 would I not have said that?
If I could get the text macro I set up to work with values I wouldn't be here asking for help..
 
Upvote 0

Forum statistics

Threads
1,215,377
Messages
6,124,598
Members
449,174
Latest member
chandan4057

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