I have the following code in order to insert a new row and populate with data. If I just run the code it works ok but I only want it to run if the date is not already in the column so I have encased it in an IF statement but it fails to execute:
Sub PasteValues()
If Not IsError(Application.Match(Sheet10.[A1], Sheet6.[B1:65000], 0)) Then
Rows("4:4").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B4").Select
ActiveCell.FormulaR1C1 = "=LastUpdate!R[-3]C[-1]"
Range("C5:AP5").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Range("C4").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Range("B4:AP4").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End If
End Sub
application.worksheetfunction.match(but I would consider architect it without a worksheet function and just use code.