Forum Discussion
valentingiaufer
Oct 18, 2023Copper Contributor
Automatically added @ in formulas
Hello I want to add a formula in my cell: =SheetNameFunc()&""-""&ANNEE(AUJOURDHUI())&""-""&MOIS(AUJOURDHUI()) But each time the formula is added in the cell, excel automatically add...
- Oct 19, 2023
The Formula property expects a formula in English. You could use
ThisWorkbook.Sheets(SheetName).Range("H1").Formula = "=TEXTJOIN(""-"",,""Export"",SheetNameFunc(),YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY()))
To specify it in your local language, use FormulaLocal:
ThisWorkbook.Sheets(SheetName).Range("H1").FormulaLocal = "=JOINDRE.TEXTE(""-"";;""Export"";SheetNameFunc();ANNEE(AUJOURDHUI());MOIS(AUJOURDHUI());JOUR(AUJOURDHUI()))
Lorenzo
Silver Contributor
As workaround do everything in SheetNameFunc:
Function SheetNameFunc()
SheetNameFunc = ActiveSheet.Name & "-" & Year(Date) & "-" & Month(Date)
End Function
valentingiaufer
Oct 19, 2023Copper Contributor
Thanks for your reply but I want it to be dynamic on the sheet so each time I print it, it displays the current date of the print