I'm getting Error 1004 AutoFill method of Range Class failed for the the below code. I have ran the code multiple times before and there has been no issue. Not sure what's causing the bug all of a sudden.
Thanks.
Chkstartrow = miscChecks.Cells(miscChecks.Rows.Count, ChktransIDcol.column).End(xlUp).Row + 1
misclastCol = miscChecks.Cells(1, miscChecks.Columns.Count).End(xlToLeft).column
miscChecks.Activate
miscChecks.Range("A1").Select
For i = 1 To misclastCol
ElseIf ActiveCell.Value = "MMB" Then
Set ChktransIDcol = miscChecks.Rows("2:2").Find(what:="Reference", LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False, SearchFormat:=False)
Set MMBtransIDcol = MMB.Rows("1:1").Find(what:="Reference Number", LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False, SearchFormat:=False)
Set MMBdatacol = MMB.Rows("1:1").Find(what:=ActiveCell.Offset(1, 0).Value, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False, SearchFormat:=False)
ChklastRow = miscChecks.Cells(miscChecks.Rows.Count, ChktransIDcol.column).End(xlUp).Row
miscChecks.Cells(Chkstartrow, i).Formula = "=IFNA(INDEX(MMB!" & MMB.Columns(MMBdatacol.column).Address(Rowabsolute:=False) & ", MATCH(" & miscChecks.Cells(Chkstartrow, ChktransIDcol.column).Address(Rowabsolute:=False) & ",MMB!" & MMB.Columns(MMBtransIDcol.column).Address(Rowabsolute:=False) & ",0)),""-"")"
miscChecks.Cells(Chkstartrow, i).Select
1004 Error Selection.AutoFill Destination:=Range(Cells(Chkstartrow, i), Cells(ChklastRow, i)), Type:=xlFillDefault
miscChecks.Range(miscChecks.Cells(Chkstartrow, i), Cells(ChklastRow, i)).Copy
miscChecks.Cells(Chkstartrow, i).PasteSpecial Paste:=xlPasteValues