I have tried recording it manually using a macro as Dave suggested and
the code Deepak suggested with no luck.

Here's the weird part, if the source is anything other than another
Excel workbook, the past special code works fine.  For example if I
copy something out of Word, IE, Outlook, or even the same Excel
workbook, the past special VBA I have works with no errors.  But if my
copy source is another Excel workbook, I get the "Run-time error
'1004': PasteSpecial method of Range class failed" message.

I was thinking maybe it had something to do with selecting the right
workbook, so I tried:

    Workbooks("Workbook.xls").Activate
    Sheets("Sheet_Name").Select
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValues
    Range("A1").Select

Workbook.xls is the name of the workbook I am pasting to and
Sheet_Name is the name of the sheet in Workbook.xls I am pasting to.

Any thoughts on this one?  Thanks.


On Dec 1, 2:33 am, Deepak Rai <daksh1...@gmail.com> wrote:
> Hi,
>
> Please try this code, Hope this will help.
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
>         :=False, Transpose:=False
>
> Regards,
>
> Deepak Rai
>
> On Tue, Dec 1, 2009 at 10:03 AM, Dave Bonallack
> <davebonall...@hotmail.com>wrote:
>
>
>
>
>
> > Hi,
> > Try doing it manually with the macro recorder on, then look at the syntax.
> > Dave.
>
> > > Date: Mon, 30 Nov 2009 10:05:31 -0800
> > > Subject: $$Excel-Macros$$ Run-time error '1004': PasteSpecial method of
> > Range class failed
> > > From: jon.wester...@gmail.com
> > > To: excel-macros@googlegroups.com
>
> > > This is something that seems pretty simple, I am trying to paste
> > > values into a workbook using a macro:
>
> > > Range("A1").Select
> > > Selection.PasteSpecial Paste:=xlPasteValues
>
> > > I start out by manually copying a range of cells in a separate
> > > workbook and clicking a form button to paste the values. Each time I
> > > do this I get "Run-time error '1004': PasteSpecial method of Range
> > > class failed"
>
> > > The cells a am copying range from columns A-N and the total number of
> > > rows varies. I have also tried:
>
> > > Range("A1:N11").Select
> > > Selection.PasteSpecial Paste:=xlPasteValues
>
> > > with no luck.
>
> > > --
>
> > ---------------------------------------------------------------------------­-------
> > > Some important links for excel users:
> > > 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
> >http://www.excelitems.com
> > > 2. Excel tutorials athttp://www.excel-macros.blogspot.com
> > > 3. Learn VBA Macros athttp://www.vbamacros.blogspot.com
> > > 4. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > > To post to this group, send email to excel-macros@googlegroups.com
> > > If you find any spam message in the group, please send an email to:
> > > Ayush Jain @ jainayus...@gmail.com or
> > > Ashish Jain @ 26may.1...@gmail.com
> > > <><><><><><><><><><><><><><><><><><><><><><>
> > > HELP US GROW !!
>
> > > We reach over 6,500 subscribers worldwide and receive many nice notes
> > about the learning and support from the group. Our goal is to have 10,000
> > subscribers by the end of 2009. Let friends and co-workers know they can
> > subscribe to group at
> >http://groups.google.com/group/excel-macros/subscribe
>
> > ------------------------------
> > Check out The Great Australian Pay Check now Want to know what your boss
> > is paid? <http://clk.atdmt.com/NMN/go/157639755/direct/01/>
>
> > --
>
> > ---------------------------------------------------------------------------­-------
> > Some important links for excel users:
> > 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
> >http://www.excelitems.com
> > 2. Excel tutorials athttp://www.excel-macros.blogspot.com
> > 3. Learn VBA Macros athttp://www.vbamacros.blogspot.com
> > 4. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>
> > To post to this group, send email to excel-macros@googlegroups.com
> > If you find any spam message in the group, please send an email to:
> > Ayush Jain @ jainayus...@gmail.com or
> > Ashish Jain @ 26may.1...@gmail.com
> > <><><><><><><><><><><><><><><><><><><><><><>
> > HELP US GROW !!
>
> > We reach over 6,500 subscribers worldwide and receive many nice notes about
> > the learning and support from the group. Our goal is to have 10,000
> > subscribers by the end of 2009. Let friends and co-workers know they can
> > subscribe to group at
> >http://groups.google.com/group/excel-macros/subscribe
>
> --
> Thanks,
>
> Deepak Rai- Hide quoted text -
>
> - Show quoted text -

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe

Reply via email to