Vlookup计数器范围值

时间:2015-08-04 16:43:14

标签: excel vba for-loop vlookup

我正在尝试进行Vlookup,定义的范围是For:

的计数器值
For N2 = 4 To ThisWorkbook.Worksheets.Count
Range("B3").End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Formula = "=VLOOKUP($B5,'[" & N2 & "]'!$B$4:$AH$35,MATCH(C$3,'[" & N2 & "]'!$B$3:$AH$3,0),FALSE)"
Next N2

但是'[“& N&”]'要求我打开“3”文件,但我想在工作表编号3中执行vlookup

你能帮我纠正一下吗?

由于

1 个答案:

答案 0 :(得分:0)

For N2 = 4 To ThisWorkbook.Worksheets.Count
Range("B3").End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Formula = "=VLOOKUP($B5,'Sheet" & N2 & "'!$B$4:$AH$35,MATCH(C$3,'Sheet" & N2 & "'!$B$3:$AH$3,0),FALSE)"
Next N2