[FONT="]Hi,
[/FONT]
[FONT="]vba stops when trying to insert formula to a cell with string variable that have apostrophe in it[/FONT]
[FONT="]In this formula[/FONT]
[FONT="]ActiveCell.FormulaR1C1 = "=IF(RC7="""","""",IF('[" & TKNAME & "]aaa'!R[-3]C[18]="""","""",'[<wbr style="font-family: Arial, sans-serif; font-size: 12.8px;">" & TKNAME & "]aaa'!R[-3]C[18]))"[/FONT]
[FONT="]when TKNAME does not apostrophe in it t then he formula is inserted to the cell with no problem ( for example TKNAME=ABC)[/FONT]
[FONT="]but if TKNAME has apostrophe in it then vba stops and does not insert the formula ( for example TKNAME=ABC'[/FONT]
[FONT="]Thank you!
* I asked this question in another forum and didn't get helpful answer[/FONT]
[/FONT]
[FONT="]vba stops when trying to insert formula to a cell with string variable that have apostrophe in it[/FONT]
[FONT="]In this formula[/FONT]
[FONT="]ActiveCell.FormulaR1C1 = "=IF(RC7="""","""",IF('[" & TKNAME & "]aaa'!R[-3]C[18]="""","""",'[<wbr style="font-family: Arial, sans-serif; font-size: 12.8px;">" & TKNAME & "]aaa'!R[-3]C[18]))"[/FONT]
[FONT="]when TKNAME does not apostrophe in it t then he formula is inserted to the cell with no problem ( for example TKNAME=ABC)[/FONT]
[FONT="]but if TKNAME has apostrophe in it then vba stops and does not insert the formula ( for example TKNAME=ABC'[/FONT]
[FONT="]Thank you!
* I asked this question in another forum and didn't get helpful answer[/FONT]