how to get a simple macro to paste value

S

sumesh56

i want a shortcut to paste values. the normal method is copy somethin
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
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 Su
 
C

Claus Busch

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.
 
S

sumesh56

Claus said:
Hi,

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

before you can paste you have to copy.
Try:

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


Regards
Claus B.

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 shee
click on R3 cell to where i wanted the display .before doing that i hav
edited the macro 'A1' to R3. the message is
Runtime error '9'
Subscript out of range
 
C

Claus Busch

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.
 
S

sumesh56

Claus said:
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 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
make your selection to copy and run the macro. Don't go to another
sheet.> > >
but that is what i wanted. i shall make a selection in on
sheet and go to another sheet click on a cell and then run the macro.
should get the result displayed from the cell.[color=blue[/QUOTE]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top