I am creating a fairly simple macro that copies data from one sheet and pastes it on another.
Worksheets("drawer cutlist").Range("B6").Select
Do Until ActiveCell.Value = ""
Sheets("Sq footage calc").Select
Rows("3:3").EntireRow.Select
Selection.Insert shift:=xlDown, copyorigin:=xlFormatFromLeftOrAbove
Range("a3").Select
ActiveCell.FormulaR1C1 = "2"
Range("E4:F4").Copy Destination:=Range("E3:F3")
Sheets("Drawer cutlist").Select
ActiveCell.Select
Selection.Copy
Sheets("Sq footage calc").Select
Range("b3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Drawer cutlist").Select
ActiveCell.Offset(0, 2).Range("A1").Select
Selection.Copy
Sheets("Sq footage calc").Select
Range("c3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("3:3").EntireRow.Select
Selection.Insert shift:=xlDown, copyorigin:=xlFormatFromLeftOrAbove
Range("a3").Select
ActiveCell.FormulaR1C1 = "2"
Range("E4:F4").Copy Destination:=Range("E3:F4")
Sheets("Drawer cutlist").Select
ActiveCell.Offset(2, -2).Copy Destination:=Sheets("sq footage calc").Range("b3").Value
ActiveCell.Offset(0, 2).Copy Destination:=Sheets("sq footage calc").Range("c3").Value
Worksheets("sq footage calc").Rows("3:3").EntireRow.Insert shift:=xlDown, copyorigin:=xlFormatFromLeftOrAbove
Worksheets("sq footage calc").Range("a3").FormulaR1C1 = "1"
Worksheets("sq footage calc").Range("e4,f4").Copy Destination:=Sheets("sq footage calc").Range("e3,f3")
ActiveCell.Offset(2, -2).Copy Destination:=Sheets("sq footage calc").Range("B3").Value
ActiveCell.Offset(0, 2).Copy Destination:=Sheets("sq footage calc").Range("B3").Value
ActiveCell.Offset(-2, 3).Select
Loop
The first part is basically what I got from recording. I tried to simplify the code by using
ActiveCell.Offset(2, -2).Copy Destination:=Sheets("sq footage calc").Range("b3").Value
but when i try to run it it stops there and gives me the error message
Run-time error '1004': copy method of range class failed.
I know I can just repeat the first part of the code to get the results I want, but I was just curious why this line doesn't work.
Thanks,
Mike
Worksheets("drawer cutlist").Range("B6").Select
Do Until ActiveCell.Value = ""
Sheets("Sq footage calc").Select
Rows("3:3").EntireRow.Select
Selection.Insert shift:=xlDown, copyorigin:=xlFormatFromLeftOrAbove
Range("a3").Select
ActiveCell.FormulaR1C1 = "2"
Range("E4:F4").Copy Destination:=Range("E3:F3")
Sheets("Drawer cutlist").Select
ActiveCell.Select
Selection.Copy
Sheets("Sq footage calc").Select
Range("b3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Drawer cutlist").Select
ActiveCell.Offset(0, 2).Range("A1").Select
Selection.Copy
Sheets("Sq footage calc").Select
Range("c3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("3:3").EntireRow.Select
Selection.Insert shift:=xlDown, copyorigin:=xlFormatFromLeftOrAbove
Range("a3").Select
ActiveCell.FormulaR1C1 = "2"
Range("E4:F4").Copy Destination:=Range("E3:F4")
Sheets("Drawer cutlist").Select
ActiveCell.Offset(2, -2).Copy Destination:=Sheets("sq footage calc").Range("b3").Value
ActiveCell.Offset(0, 2).Copy Destination:=Sheets("sq footage calc").Range("c3").Value
Worksheets("sq footage calc").Rows("3:3").EntireRow.Insert shift:=xlDown, copyorigin:=xlFormatFromLeftOrAbove
Worksheets("sq footage calc").Range("a3").FormulaR1C1 = "1"
Worksheets("sq footage calc").Range("e4,f4").Copy Destination:=Sheets("sq footage calc").Range("e3,f3")
ActiveCell.Offset(2, -2).Copy Destination:=Sheets("sq footage calc").Range("B3").Value
ActiveCell.Offset(0, 2).Copy Destination:=Sheets("sq footage calc").Range("B3").Value
ActiveCell.Offset(-2, 3).Select
Loop
The first part is basically what I got from recording. I tried to simplify the code by using
ActiveCell.Offset(2, -2).Copy Destination:=Sheets("sq footage calc").Range("b3").Value
but when i try to run it it stops there and gives me the error message
Run-time error '1004': copy method of range class failed.
I know I can just repeat the first part of the code to get the results I want, but I was just curious why this line doesn't work.
Thanks,
Mike