I have formulas that seem to work fine when used in a worksheet, but when I try to use a code to enter the formulas, it was kicking back a compile error. I understand that adding double quotes will fix most of the issues. I am now running into issues with the # and @ symbol. The @ symbol kicks back an "invalid character" error now.
Any help would be much appreciated!
Sub enterformulas()
Worksheets("Cleaning").Range("B2").Formula = "=TRIM(A2)"
Worksheets("Cleaning").Range("C2").Formula = "=IFERROR(LEFT(B2,SEARCH("" "", B2)-1),"")"
Worksheets("Cleaning").Range("D2").Formula = "=IFERROR(TRIM(REPLACE(REPLACE(A2,SEARCH(E2,A2),LEN(E2),""),1,LEN(C2),"")),"")"
Worksheets("Cleaning").Range("E2").Formula = "=IFERROR(RIGHT(B2, LEN(B2) - SEARCH(""#"", SUBSTITUTE(B2,"" "", ""#"", LEN(B2) - LEN(SUBSTITUTE(B2, "" "", ""))))),B2)"
Worksheets("Cleaning").Range("G2").Formula = "=TRIM(F2)"
Worksheets("Cleaning").Range("H2").Formula = "=IFERROR(SUBSTITUTE(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(LEFT(G2,FIND("" "",G2&"" "",FIND("@",G2))-1),"" "",REPT("" "",LEN(G2))),LEN(G2))),"[",""),"]",""),"")"
End Sub