Q:

Countif until the last row in specific column is populated

I have a problem with finishing my macro. It uses the COUNTIF function and checks the whole A column (A:A - no exclusions) against the data from B2. I would like to make the autofill in the C column until the last value in the B column - just like presented on the picture below:

Could anyone help me what should I add to my code to make this autofill possible??
Sub Countif()

Range("C2").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-2],RC[-1])"
Selection.AutoFill Destination:=Range("C2:C10"), Type:=xlFillDefault
Range("C2:C10").Select

End Sub

A:

If you wanna achieve using VBA try below code. Just Run the macro and it wud fill up the column C uptil values in column B.
Sub sample()

Dim LastRowColumnB As Long
LastRowColumnB = Range("B65000").End(xlUp).Row

For i = 2 To LastRowColumnB
    Cells(i, 3) = Application.CountIf(Range("A:A"), Cells(i, 2))
Next
End Sub

