I am currently working on an Excel VBA macro to automate spreadsheet formatting and formula filling.
I keep running into a type mismatch issue, with string and variant/string types.
The command to insert the formula (left side of = sign) is type variant/string while the formula itself is string type. How do i convert the referenced list/formula to a variant type, or the left side to a string type?
Can give more detail as necessary, Ive searched all over and cant find a solution. Thanks.
code in question:
Sub AddFormulas()
lr = Cells.Find("*", Cells(1, 1), xlFormulas, xlPart, xlByRows, xlPrevious, False).Row
Range("G4").Formula = "=INDEX('wks'!$A$2:$A$411, MATCH(1, COUNTIF(F4, " * "&'wks'!$A$2:$A$411&" * "), 0))"
Range("G4").AutoFill Range("G4:G" & lr)
End Sub