Forum Discussion
moczare
Oct 29, 2021Copper Contributor
VBA Auto fill formula help
Hi guys I need help with a macro I’m creating this is what I have so far Range(“J2”).Select ActiveCell.FormulaR1C1 = “=IFERROR(RC[-1]/RC[-2],0)” Range(“J2”).Select Range(“J2”).AutoFill Range(“...
HansVogelaar
Oct 29, 2021MVP
Please don't use curly quotes “ ” around text strings in VBA. Always use straight quotes " ".
Dim LastRow As Long
LastRow = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Range("J2:J" & LastRow).FormulaR1C1 = "=IFERROR(RC[-1]/RC[-2],0)"