Archive of Mr Excel Message Board

Back to Excel VBA archive index
Back to archive home

Macro - Run Time Error '1004'

Posted by Renee' on August 15, 2001 5:47 AM
We are working on an existing file with Macros that someone else has set up. We are trying to add information to the file and when we try to run a Macro, we are getting the following error "Run Time Error '1004' PasteSpecial method of Range class failed". When we choose 'debug', it goes to the following line in the Macro:

Selection.PasteSpecial Paste:=x1Values, Operation:=x1Add, SkipBlanks:= _ True, Transpose:=False

We are just learning about Macros and I'm not sure how to figure out what it doesn't like here. Any advice would be helpful! THANKS!!!!!!!!!

Check out our Excel VBA Resources

Re: Macro - Run Time Error '1004'

Posted by Barrie Davidson on August 15, 2001 8:12 AM

Can you post the entire code?


Re: Macro - Run Time Error '1004'

Posted by Renee' on August 16, 2001 10:33 AM

Here's the entire code...

Application.Goto Reference:="R1C2"
Workbooks.Open FileName:= _
"\\filename is listed here"
Application.Goto Reference:="R1C2"
Selection.PasteSpecial Paste:=xlValues, Operation:=xlAdd, SkipBlanks:= _
True, Transpose:=False
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "4103"
ActiveWindow.LargeScroll Down:=1
ActiveCell.FormulaR1C1 = "6106"
ActiveWindow.LargeScroll Down:=1
ActiveCell.FormulaR1C1 = "4130"
ActiveWindow.LargeScroll Down:=1
ActiveCell.FormulaR1C1 = "131"
ActiveWindow.LargeScroll Down:=1
ActiveCell.FormulaR1C1 = "134"
ActiveWindow.LargeScroll Down:=1
ActiveCell.FormulaR1C1 = "4135"
ActiveWindow.LargeScroll Down:=1
ActiveCell.FormulaR1C1 = "6317"
ActiveWindow.LargeScroll Down:=1
ActiveCell.FormulaR1C1 = "8138"
Application.Goto Reference:="R1C2"
Application.Goto Reference:="R1C1"
End Sub

Re: Macro - Run Time Error '1004'

Posted by Barrie Davidson on August 16, 2001 1:58 PM

Renee, you are getting the error because Excel is trying to paste something when nothing has been selected to copy. This macro is trying to copy column B of whatever workbook is active (i.e., in the window. Hidden workbooks are not active) and paste it into a file named "\\filename is listed here". Are you running this macro with no workbooks in the active window and do you really want the macro to open a file named that?


Re: Macro - Run Time Error '1004'

Posted by Renee' on August 20, 2001 12:07 PM

Hey Barrie! Thanks so much for your input. We got it to work! I believe what was happening, we had the file open that the macro was trying to open and we were getting an error. Appreciate your help!! Renee'

This archive is from the original message board at
All contents © 1998-2004
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.