Home > OS >  Half the code in my script is giving an error
Half the code in my script is giving an error

Time:09-21

For i = 2 To 50
ws.Range("K" & i).FormulaLocal = "=if(countif($C$2:C" & i & ";C" & i & ")=1;row();"")"
Next i

ws.Range("K" & i).FormulaLocal = "=if(countif($C$2:C" & i & ";C" & i & ")=1;row();"")

I am getting error on this line. Where am I going wrong?

CodePudding user response:

you need to double the quotation marks within the string (at the end):

ws.Range("K" & i).FormulaLocal = "=if(countif($C$2:C" & i & ";C" & i & ")=1;row();"""")"
  • Related