Public Sub InsertFormulas()
Worksheets("Setup").Activate
Worksheets("Setup").Range("U2").Formula = "=(LEN(T2)-LEN(SUBSTITUTE(T2,$T$19,"")))/(LEN($T$19))"
Worksheets("Setup").Range("W2").Formula = "=(LEN(V2)-LEN(SUBSTITUTE(V2,$U$19,"")))/(LEN($U$19))"
Worksheets("Setup").Range("Y2").Formula = "=(LEN(X2)-LEN(SUBSTITUTE(X2,V19,"")))/(LEN(V19))"
Worksheets("Setup").Range("AA2").Formula = "=(LEN(Z2)-LEN(SUBSTITUTE(Z2,$T$20,"")))/(LEN($T$20))"
Worksheets("Setup").Range("AC2").Formula = "=(LEN(AB2)-LEN(SUBSTITUTE(AB2,$U$20,"")))/(LEN($U$20))"
Worksheets("Setup").Range("AE2").Formula = "=(LEN(AD2)-LEN(SUBSTITUTE(#REF!,#REF!,"")))/(LEN(AD2))"
End Sub
This sub works when I enter simple formulas, but not with these more complicated ones.