Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何克服;对象变量或未设置块变量";在excelvba中?_Vba_Excel - Fatal编程技术网

如何克服;对象变量或未设置块变量";在excelvba中?

如何克服;对象变量或未设置块变量";在excelvba中?,vba,excel,Vba,Excel,您必须设置变量: Sub bordersTest() Dim theRange As Range theRange = Range(ActiveCell, ActiveCell.End(xlDown).End(xlToRight)).Select End Sub 谢谢你的回答,它正在发挥作用。这个问题已经在互联网上被问了大约1.385e105次,并且得到了彻底的回答。谷歌?在VBA中查找变量使用的基础知识,并查看对象变量。" Sub bordersTest() Dim t

您必须设置变量:

Sub bordersTest()
    Dim theRange As Range

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

谢谢你的回答,它正在发挥作用。这个问题已经在互联网上被问了大约1.385e105次,并且得到了彻底的回答。谷歌?在VBA中查找变量使用的基础知识,并查看对象变量。"
Sub bordersTest()
  Dim theRange As Range

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