循环已经到位,但我似乎无法获得用正确的变量替换A2的语法。
For Each c In rng1
If WorksheetFunction.CountIf(rng2, c.Value) = 0 Then
sh3.Cells(Rows.Count, 1).End(xlUp)(2) = c.Value
sh3.Cells(Rows.Count, 2).End(xlUp)(2).Formula = _
"=INDEX(MatList!$D$13:$D$62,MATCH(A2,MatList!$A$13:$A$62,0))"
End If
Next
答案 0 :(得分:3)
只需将您的公式替换为:
"=INDEX(MatList!$D$13:$D$62,MATCH(A2,MatList!$A$13:$A$62,0))"
致:
"=INDEX(MatList!$D$13:$D$62,MATCH(" & YourVariableName & ",MatList!$A$13:$A$62,0))"
答案 1 :(得分:0)
谢谢你。越来越近。虽然变量“x”同时具有0和6的值,但我现在似乎处于一个悖论中。 curious