ToddHawley4984
asked on
Excel vba Pastespecial xlvalues
Hi,
I have been trying to write a small sub that will take contents from the clipboard to an excel spreadsheet...I have two Workbooks open...I select the data i want to copy...hit Ctrl C...then go to the other workbook which i want to paste the values. On this sheet I have a button that runs the following macro...It worked earlier today but now every time i run it it hangs on the pastespecial line with the following error. "Runtime Error '1004' Pastespecial method of range class failed. I have tried every example i can find on the internet and nothing will work. Any ideas?
Thanks
I have been trying to write a small sub that will take contents from the clipboard to an excel spreadsheet...I have two Workbooks open...I select the data i want to copy...hit Ctrl C...then go to the other workbook which i want to paste the values. On this sheet I have a button that runs the following macro...It worked earlier today but now every time i run it it hangs on the pastespecial line with the following error. "Runtime Error '1004' Pastespecial method of range class failed. I have tried every example i can find on the internet and nothing will work. Any ideas?
Thanks
Sub ImportData()
Application.range("A12").select
ActiveCell.PasteSpecialxlPasteValues , xlPasteSpecialOperationNone
By chance is the destination worksheet protected, or are there any merged cells in association with A12.
Change this:
ActiveCell.PasteSpecialxlP asteValues , xlPasteSpecialOperationNon e
to this:
ActiveCell.PasteSpecial paste:=xlValues, operation:=xlPasteSpecialO perationNo ne
jppinto
ActiveCell.PasteSpecialxlP
to this:
ActiveCell.PasteSpecial paste:=xlValues, operation:=xlPasteSpecialO
jppinto
ASKER
Tom_Urtis: No to both questions.
Jppinto: Same result with your code..
This may be of help....after the code fails if i exit and try to manually pastespecial i get the dialog asking if i want to paste as HTML, Unicode Text, Text....If i try this before running to code i can pastespecial just fine....that help?
Jppinto: Same result with your code..
This may be of help....after the code fails if i exit and try to manually pastespecial i get the dialog asking if i want to paste as HTML, Unicode Text, Text....If i try this before running to code i can pastespecial just fine....that help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I opened the two spreadsheets in separate instances and it works fine...thanks