excel - Vlookup error in the first parameter -


i have problem in code. want value sheet , copy in active sheet problem condition inside loop.it gives me error in vlookup line. can detect me error:

with thisworkbook.sheets("plan traitement risque")     = 6 lr1 step 1       'test si valeur cellule feuil1!=ax est dans plage col_2(feuil2!a1:a50))     if application.countif(col_2, .range("b" & i).value) = 0      cells(i, 3).select      activecell.formula = "=vlookup(cells(i, 2).value,'scénarios de menace'!$b$6:$n$700,2,false)"     end if     next end 

the active cell formula built string. if want pass vba function cells(a, b).value string, need concatenate other parts of string, this:

activecell.formula = "=vlookup(""" & cells(i, 2).value & """,'scénarios de menace'!$b$6:$n$700,2,false)" 

edit: added quotes accommodate string in cells(i,2), suggested in comment jeeped.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -