I am writing a VBA code to input a formula into G4 and autofill to the last row of data in column G. When I run the sub, it adds an @ symbol into the formula that is not supposed to be there. If I manually delete the @, the formula works perfectly. How do I stop this from being added? Code is as follows:
Range("G4:G" & lr).Formula = "=INDEX('[Academic Codes List.xlsx]List'!$A$2:$A$411, MATCH(1, COUNTIF(F4, ""*"" & '[Academic Codes List.xlsx]List'!$A$2:$A$411&""*""), 0))"
The intended formula is:
=INDEX('[Academic Codes List.xlsx]List'!$A$2:$A$411, MATCH(1, COUNTIF(F4, ""*"" & '[Academic Codes List.xlsx]List'!$A$2:$A$411&""*""), 0))
The resultant formula from running the sub is:
=INDEX('[Academic Codes List.xlsx]List'!$A$2:$A$411, MATCH(1, COUNTIF(F4, "*"&@'[Academic Codes List.xlsx]List'!$A$2:$A$411&"*"), 0))
The ghost @ symbol is next to the first ampersand.
Thanks in advance for any suggestions.