尝试在最近打开的工作表的单元格中应用公式时,我总是收到错误消息。第三行发生错误。是什么原因引起的?
ActiveWorkbook.SaveAs "Z:\Daily Mainsource Macros\NIS.xlsx"
Workbooks.Open Filename:="file path\roster.xlsx"
Range("F2").FormulaR1C1 = "=VLOOKUP(RC[-2],'[NIS.xlsx]NIS'!C2:C5,4,0)"
Range("F2").AutoFill Destination:=Range("F2:F" & Cells(Rows.Count, "B").End(xlUp).Row)
Columns("F").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Replace What:="0", Replacement:="REWORK", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False