ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to get a simple macro to paste value (https://www.excelbanter.com/excel-discussion-misc-queries/449952-how-get-simple-macro-paste-value.html)

sumesh56

how to get a simple macro to paste value
 
i want a shortcut to paste values. the normal method is copy something and click paste options paste values.but is there a way to do it fast? can we use a simple macro?on one 'basic'named sheet i would select a range on the next sheet named 'values' it should copy the values only. why this macro gives error message?
Runtime error'1004'
Pastespecial method of range class failed.
Sub PasteVal()
Selection.PasteSpecial Paste:=xlValues
End Sub

Claus Busch

how to get a simple macro to paste value
 
Hi,

Am Mon, 24 Mar 2014 16:54:35 +0000 schrieb sumesh56:

why this macro gives error message?
Runtime error'1004'
Pastespecial method of range class failed.
Sub PasteVal()
Selection.PasteSpecial Paste:=xlValues
End Sub


before you can paste you have to copy.
Try:

Sub PasteVal()
Selection.Copy
Sheets("values").Range("A1").PasteSpecial xlPasteValues
End Sub


Regards
Claus B.
--
Vista Ultimate SP2 / Windows7 SP1
Office 2007 Ultimate SP3 / 2010 Prodessional

sumesh56

Quote:

Originally Posted by Claus Busch (Post 1616771)
Hi,

Am Mon, 24 Mar 2014 16:54:35 +0000 schrieb sumesh56:

why this macro gives error message?
Runtime error'1004'
Pastespecial method of range class failed.
Sub PasteVal()
Selection.PasteSpecial Paste:=xlValues
End Sub


before you can paste you have to copy.
Try:

Sub PasteVal()
Selection.Copy
Sheets("values").Range("A1").PasteSpecial xlPasteValues
End Sub


Regards
Claus B.
--
Vista Ultimate SP2 / Windows7 SP1
Office 2007 Ultimate SP3 / 2010 Prodessional

thank you very much for the reply. your code gives me error message.
I made a selection of a range in one sheet and went to another sheet click on R3 cell to where i wanted the display .before doing that i have edited the macro 'A1' to R3. the message is
Runtime error '9'
Subscript out of range.

Claus Busch

how to get a simple macro to paste value
 
Hi,

Am Tue, 25 Mar 2014 01:21:58 +0000 schrieb sumesh56:

I made a selection of a range in one sheet and went to another sheet
click on R3 cell to where i wanted the display .before doing that i have
edited the macro 'A1' to R3. the message is
Runtime error '9'
Subscript out of range.


make your selection to copy and run the macro. Don't go to another
sheet.


Regards
Claus B.
--
Vista Ultimate SP2 / Windows7 SP1
Office 2007 Ultimate SP3 / 2010 Prodessional

sumesh56

Quote:

Originally Posted by Claus Busch (Post 1616777)
Hi,

Am Tue, 25 Mar 2014 01:21:58 +0000 schrieb sumesh56:

I made a selection of a range in one sheet and went to another sheet
click on R3 cell to where i wanted the display .before doing that i have
edited the macro 'A1' to R3. the message is
Runtime error '9'
Subscript out of range.


make your selection to copy and run the macro. Don't go to another
sheet.


Regards
Claus B.
--
Vista Ultimate SP2 / Windows7 SP1
Office 2007 Ultimate SP3 / 2010 Prodessional

[quote]make your selection to copy and run the macro. Don't go to another
sheet.[quote]
[color=blue]but that is what i wanted. i shall make a selection in one sheet and go to another sheet click on a cell and then run the macro. i should get the result displayed from the cell.[color=blue]

sumesh56

[quote=sumesh56;1616787][quote]make your selection to copy and run the macro. Don't go to another
sheet.
Quote:

[color=blue]but that is what i wanted. i shall make a selection in one sheet and go to another sheet click on a cell and then run the macro. i should get the result displayed from the cell.[color=blue]
though i have selected color =blue why it is not coming in the post? pls instruct


All times are GMT +1. The time now is 09:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com