Sub bordersTest()
Dim theRange As Range
theRange = Range(ActiveCell, ActiveCell.End(xlDown).End(xlToRight)).Select
End Sub
Asked
Active
Viewed 1,791 times
-5

Pᴇʜ
- 56,719
- 10
- 49
- 73

Gangi reddy
- 21
- 1
- 9
-
This has been asked and thoroughly answered about 1.385e105 times all around the internet. Google? Look up the basics of variable usage in VBA and look at object variables. https://stackoverflow.com/search?q="Object+variable+or+with+block+variable+not+set" – vacip May 15 '17 at 11:02
1 Answers
1
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

Holger
- 320
- 1
- 10