我正在尝试将命名范围的值分配给变量数组。我几乎在分配代码 Material = ThisWorkbook.Names("RMInStoreName").RefersToRange 级别收到应用程序或对象定义的错误,我从这里得到了这个例子,并且在成功之前使用过它。
我仍在试图弄清楚为什么会出现此错误,我似乎已经没有想法了,任何人都可以帮助我指出正确的方向将真正为我节省很多代码在下面这是代码
Sub MonitorStore()
Dim ThreshHold As Variant, InStore As Variant, StatusReport As Variant
Dim Material As Variant 'is the name of the material
Status As Variant
'status is a variable which holds data on wether the user has seen msg and
'wants to supress msg
'the ThreshHold is the minimum allowed in store below which messages are firerd
'InStore is the volume of materials currently in store
'and be told of another error after solving error one, report all at once
Material = ThisWorkbook.Names("RMInStoreName").RefersToRange
ThreshHold = ThisWorkbook.Names("RMThreshHold").RefersToRange
InStore = ThisWorkbook.Names("RMInStore").RefersToRange
Status = ThisWorkbook.Names("RMStatus").RefersToRange
'other code.............
'dont expect error from unexecuted code
End Sub
感谢斯蒂芬的帮助