View Single Post
  #1   Report Post  
setoFairfax
 
Posts: n/a
Default Excel 1004 Error When Pasting Special W/ Macro

Hi all,
I'm looking for some help with this macro...it has me really confused
because it was working earlier, but now it hangs on this line of code (it is
asterisked below)

Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

This macro runs when the workbook opens and copies the contents of one
sheet and pastes only the values to another sheet. The range that is being
copied from and pasted to are both the same size. I have also tried this by
selecting the upper-leftmost cell in the area I want to paste to but it has
the same effect. Please help!

The exact error message is;
Runtime Error '1004': PasteSpecial method Range of class failed

__________________________________________________ ______________
Private Sub Workbook_Open()
Sheets("Permit Records").Select
Range("A5").Select
ActiveWindow.ScrollRow = 493
Range("A5:M504").Select
ActiveWindow.ScrollRow = 6
Selection.Copy
Range("A1").Select
Sheets("Final Inspection").Select
ActiveSheet.Unprotect Password:="XXXX"
Range("A5").Select
ActiveWindow.ScrollRow = 492
Range("A5:M504").Select
ActiveWindow.ScrollRow = 5
***Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Range("A1").Select
ActiveSheet.Protect Password:="XXXX", DrawingObjects:=True,
Contents:=True, Scenarios:=True
Sheets("Permit Records").Select
Application.CutCopyMode = False
Range("A1").Select
End Sub