简体   繁体   中英

Vlookup Range of a counter Value

I'm trying to do a Vlookup an the defined range is the counter value of the 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

But the '[" & N & "]' asks me to open the "3" file but I want to do the vlookup in the Worksheet number 3

Could you please help me to correct that part?

Thanks

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM