Hello Friends of Excel,
I found this great formula on this forum that executes exactly what I need. https://www.mrexcel.com/forum/excel...haracters-cell-before-specific-character.html
However, I try to appy this formula to a range of cells using VBA, I get a Compile Error: Syntax Error
My third line of code is highlighted red. I think this is because VBA is seeing the starting " and thinks it ends with the next ", when really it doesn't, that is just part of the formula.
Is this correct? If so, if there another formula that could be used to retrieve a variable number of characters in a cell before a specific character? OR is there a better way to apply this formula to a used range that matches the used range in Column A?
I found this great formula on this forum that executes exactly what I need. https://www.mrexcel.com/forum/excel...haracters-cell-before-specific-character.html
However, I try to appy this formula to a range of cells using VBA, I get a Compile Error: Syntax Error
Code:
Dim LastRowColumnA As Long
LastRowColumnA = Cells(Rows.Count, 1).End(xlUp).Row
Range("B2:B" & LastRowColumnA).Formula = "=LEFT(A2,FIND(".",A2&".")-1)"
My third line of code is highlighted red. I think this is because VBA is seeing the starting " and thinks it ends with the next ", when really it doesn't, that is just part of the formula.
Is this correct? If so, if there another formula that could be used to retrieve a variable number of characters in a cell before a specific character? OR is there a better way to apply this formula to a used range that matches the used range in Column A?