运行时错误对象变量或未设置变量

时间:2018-05-04 10:06:30

标签: object variables runtime-error

我在下面的代码中得到“运行时错误'91':对象变量或没有设置块变量”,似乎无法解决问题。

我设置了以下变量:

Dim EngineAncillariesProjectsVBAList As Range
Dim EngineAncillariesProjectsLastRow As Long
Dim ProjectList As Range

由以下人员定义:

EngineAncillariesProjectsLastRow = Worksheets("VBA_Data").Cells(Rows.Count, 8).End(xlUp).Row

Set EngineAncillariesProjectsVBAList = Worksheets("VBA_Data").Range("H2:H" & EngineAncillariesProjectsLastRow)

错误即将发生,见下文。在Debug上,它说ProjectList = Nothing

If ActiveSheet.Name = "Engine Ancillaries" Then ProjectList = EngineAncillariesProjectsVBAList

0 个答案:

没有答案