如何在ExcelVBA中正确写出VLOOKUP公式?错误是什么?

How to write VLOOKUP formula correctly in Excel VBA? What is the error?

我想要 'vlookup' 范围内的公式("H1:H70")

For i = 1 To 70
    Worksheets(1).Range("H"&i).Formula= "=VLOOKUP("F"&i;'anotherSheet'!$A:$C;2;0)"
Next i

正确的拼写是Sheets(1).Range("H" & i).Formula = "=VLOOKUP(F" & i & ",'anotherSheet'!$A:$C,2,0)"

根据您的语言设置,您在工作表中键入公式时使用 ; 作为分隔符,但在 VBA 中键入公式时使用 ,