在Excel VBA中,我的问题是我的代码公式vlookup不适用于Array。 错误“类型不匹配”出现。
Dim MyArray() As Variant
ReDim MyArray(1 To 4, 1 To 4)
For z = 1 To 4
For g = 1 To 4
MyArray(z, g) = shMap.Range("mcompany").Cells(z, g).Value
Next g
Next z
shAll.Range("I2").FormulaR1C1 = "=VLOOKUP(RC[-8]," & MyArray & ",4,FALSE)"
shAll.Cells(2, 9).AutoFill Destination:=shAll.Range("I2:I" & LastRow)