Hello fellow programmers!
I am new to VBA and shall make big changes in an existing Excel template... Now my problem is, while trying to export a Formula from excel (it is supposed to work later on button click), that I am unable to use this simple step:
Sub InsertTodaysDate()
' This macro will put today's date in cell A1 on Sheet1
Sheets("Sheet1").Select
Range("A1").Select
Selection.Formula = "=text(now(),""mmm dd yyyy"")"
Selection.Columns.AutoFit
End Sub
This does work but when inserting my sadly big formula
Sub InsertTodaysDate()
Sheets("Sheet1").Select
Range("A1").Select
Selection.FormulaLocal = "=WENN(LÄNGE('Step 2 - Add Contact Informatio'!A4)>100;""too many characters"";""
WENN('Step 2 - Add Contact Informatio'!A4="""";""Email is mandatory"";
WENN(ISTZAHL(FINDEN(""!"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""*"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN("":"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""="";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""`"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""\"";
'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""]"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""["";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""}"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""{"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""´"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""?"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";WENN(ISTZAHL(FINDEN("")"";
'Step 2 - Add Contact Informatio'!A4));""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""("";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";WENN(ISTZAHL(FINDEN(""/"";'Step 2 - Add Contact Informatio'!A4));""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""&"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""%"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""$"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""§"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""~"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""“"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""^"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""°"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""<"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN("" "";'Step 2 - Add Contact Informatio'!A4));
""spaces are not allowed"";
WENN(ISTZAHL(FINDEN(""#"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN(""'"";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN("","";'Step 2 - Add Contact Informatio'!A4));
""special characters are not allowed"";
WENN(ISTZAHL(FINDEN("">"";'Step 2 - Add Contact Informatio'!A4));""special characters are not allowed"";
WENN(ISTFEHLER(D8);""error"";WENN(D8=FALSCH;""error"";""ok"")))))))))))))))))))))))))))))))))"
End Sub
I get an Syntax Error, I even tried escaping the "" with \"\" but that just worked for half of the formula. Does anybody know what the problem is?