Forum Discussion
hrh_dash
Sep 14, 2022Iron Contributor
vba countif formula
How do i correct the countif formula for using the FormulaR1C1 method? Excel formula is as follows: B2 to the last row = Countif(A:A,A1) and this be drag down to the last row with value Macr...
- Sep 22, 2017
Okay, at least that's not the formula as the text. Do you receive the #Value with reference on the single cell?, like
='Customer Data'!BI4
Harun24HR
Sep 14, 2022Bronze Contributor
hrh_dash Try below sub-
Sub MyMacro()
Dim Destws As Worksheet
Set Destws = Worksheets("Sheet1")
lastrow = Destws.Cells(Destws.Rows.Count, "A").End(xlUp).Row
Destws.Range("B2:B" & lastrow).FormulaR1C1 = "=COUNTIFS(RC[-1]:R[" & lastrow & "]C[-1],RC[-1])"
End Sub
- hrh_dashSep 14, 2022Iron Contributorthanks for the assist!