如何在excel VBA中克服“对象变量或未设置块变量”?

时间:2017-05-15 10:49:21

标签: excel vba excel-vba

Sub bordersTest()
    Dim theRange As Range

    theRange = Range(ActiveCell, ActiveCell.End(xlDown).End(xlToRight)).Select
End Sub

1 个答案:

答案 0 :(得分:1)

您必须设置变量:

Sub bordersTest()
  Dim theRange As Range

  Set theRange = Range(ActiveCell, ActiveCell.End(xlDown).End(xlToRight))
  theRange.Select
End Sub