我有以下代码,并且在 For 循环中的所有部分都出现“无法识别光标下的标识符”。
Sub Finalize_Macro()
'
' Finalize all data on the Offer Data worksheet
'
Dim DSheet As Worksheet
Dim PSheet As Worksheet
Dim LastRow As Long
Dim ValCol As Long
Dim DayCol As Long
Dim i As Integer
Set DSheet = Worksheets("Offer Data")
Set PSheet = Worksheets("PivotTable")
LastRow = DSheet.Cells(Rows.Count, 1).End(xlUp).Row
ValCol = PSheet.Cells(2, Columns.Count).End(xlToLeft).Column - 1
DayCol = PSheet.Cells(2, Columns.Count).End(xlToLeft).Column
DSheet.Select
[E1:I1] = [{"Redemption Value", "Redemption Days", "Theo", "Actual", "Rated Days"}]
For i = 2 To LastRow
Cells(i, 5).Formula = "=IFERROR(XLOOKUP(A" & i & ",PivotTable!(A:A),PivotTable!.Columns(" & ValCol & ")),0)"
Cells(i, 6).Formula = "=IFERROR(XLOOKUP(A" & i & ",PivotTable!(A:A),PivotTable!.Columns(" & DayCol & ")),0)"
Cells(i, 7).Formula = "=IFERROR(XLOOKUP(A" & i & ",'Big Query Data'!(B:B),'Big Query Data'!(C:C)),0)"
Cells(i, 8).Formula = "=IFERROR(XLOOKUP(A" & i & ",'Big Query Data'!(B:B),'Big Query Data'!(D:D)),0)"
Cells(i, 9).Formula = "=IFERROR(XLOOKUP(A" & i & ",'Big Query Data'!(B:B),'Big Query Data'!(E:E)),0)"
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
如果有人可以帮助告知为什么这不起作用,我将不胜感激!