I am having problems using the below test macro, just to see if I can get the first stage of this if statement working for a formula.

Here's the macro part of it:

[VBA]Dim margin As Double
Dim cost As Double


Cells(1, 4).Select
Selection.EntireColumn.Select
Selection.Insert Shift:=xlToLeft

Cells(1, 4).Select

Dim LastRowPriceMargin As String

LastRowPriceMargin = Cells(Rows.Count, "A").End(xlUp).Row

'Range("D1").Resize(LastRowPriceMargin).Formula = "=$E1" & "*" & margin & "+" & cost
Range("D1").Resize(LastRowPriceMargin).Formula = "=IF($E1=""LAS"",""IS LASER"",""IS INK"")"""

Cells.Select

Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False[/VBA]

What it basically does is go to column D, inputs a value (or is supposed to), that tests if column E has value LAS (if this is true, D column brings up IS LASER) then likewise for the other value.

Can someone help me with this as to why it saying object defined error please?

I'd appreciate any advice,
Jeremy