Hi I am getting this error in this code which is part of a larger macro. It always stops here giving the runtime error 1004 or 424 message. The macro sometimes gets through the whole sub routine and other times it gives this error. Thanks for your help.
'Attach brandtags
Dim lastRow As Long
With Sheets("OUT_main")
lastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
.Range("D2:G2").FormulaR1C1 = "=VLOOKUP(RC3,'48_OUT'!R2C3:R3163C7,2,0)"
.Range("E2").FormulaR1C1 = "=VLOOKUP(RC3,'48_OUT'!R2C3:R3163C7,3,0)"
.Range("F2").FormulaR1C1 = "=VLOOKUP(RC3,'48_OUT'!R2C3:R3163C7,4,0)"
.Range("G2").FormulaR1C1 = "=VLOOKUP(RC3,'48_OUT'!R2C3:R3163C7,5,0)"
.Range("D2:G2").AutoFill Destination:=.Range("D2:G" & lastRow)
.Range("B2:B" & lastRow).FormulaR1C1 = "=INDEX('48_OUT'!C,MATCH(RC[1],'48_OUT'!C[1],0))"
End With
Sheets("48_OUT").Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("OUT_Main").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Application.DisplayAlerts = False
Sheets(Array("1 (1)", "Market Share adj", "48_OUT")).Select
Sheets("48_OUT").Activate
ActiveWindow.SelectedSheets.Delete
Sheets("OUT_Main").Select
Application.CutCopyMode = False
Selection.AutoFilter
End Sub
Bookmarks