Using xlDown
highly unreliable. Use this one instead:
Sub CountRng1()
Dim lastrow As Long
Dim rng1 As Range
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set rng1 = Range("A2:A" & lastrow)
Range("C1").Formula = "=COUNTIF(" & rng1.Address & ","">"" & B1)"
End Sub
Read this please: How to determine last used row/column
Also I suggets you to fully qualify your ranges, i.e. change Range("A1")
to ThisWorkbook.Worksheets("sheetName").Range("A1")