PDA

View Full Version : Solved: Why am I getting an error?



Opv
03-31-2012, 02:13 PM
What is causing an "Object Required" error on the second line of this code? Interestingly, the copy/paste actually occurs as desired, the error notwithstanding.


Range("A17").EntireRow.Copy
Range("A15").EntireRow.Insert(Shift:=xlDown).Paste

mikerickson
03-31-2012, 03:01 PM
Insert is a method that doesn't return an object. Hence the "Object requried" (for the .Paste method) error. Try

Range("A15").EntireRow.Insert Shift:=xlDown, CopyOrigin:=True

Opv
03-31-2012, 03:06 PM
Insert is a method that doesn't return an object. Hence the "Object requried" (for the .Paste method) error. Try

Range("A15").EntireRow.Insert Shift:=xlDown, CopyOrigin:=True

Now I'm getting a "Named Argument not found" with respect to the "CopyOrigin". Does the recommended procedure only work on newer versions of Excel? I should have stated at the outset that I'm running Outlook 2000.

chamdan
03-31-2012, 03:06 PM
Use this instead.

Range("A15").Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False

Chuck

Opv
03-31-2012, 06:28 PM
Thanks, chamdan. I was hoping to avoid having to use "Select." I think I have figured out how to make mikerickson's suggestion work.

Opv
03-31-2012, 07:12 PM
Thanks, by the way, to mikerickson. I appreciate the help.