You have to set the variable:
Sub bordersTest()
Dim theRange As Range
Set theRange = Range(ActiveCell, ActiveCell.End(xlDown).End(xlToRight))
theRange.Select
End Sub
1
solved How to overcome “object variable or with block variable not set” in excel VBA? [duplicate]