Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Senior Member
 
Posts: 118
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default 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
  #3   Report Post  
Senior Member
 
Posts: 118
Default

Quote:
Originally Posted by Claus Busch View Post
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.
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default 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
  #5   Report Post  
Senior Member
 
Posts: 118
Default

Quote:
Originally Posted by Claus Busch View Post
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]


  #6   Report Post  
Senior Member
 
Posts: 118
Default

[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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Macro - I think... Copy - Paste on Click Scott Campbell[_2_] Excel Discussion (Misc queries) 5 November 14th 12 01:52 AM
Need simple macro to copy and paste values Bern Notice[_2_] Excel Programming 1 March 13th 09 02:21 AM
Need simple 'Paste' macro code [email protected] Excel Programming 1 April 14th 07 01:10 PM
How to write a simple copy-paste macro? R. H. Rosenberg New Users to Excel 4 November 25th 06 01:26 AM
Simple Cut & Paste Macro needed :) dstock[_13_] Excel Programming 7 June 22nd 05 03:08 PM


All times are GMT +1. The time now is 01:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"