我想分配一個命名範圍的值的變量數組。我幾乎在賦值代碼 Material = ThisWorkbook.Names(「RMInStoreName」)處得到應用程序或對象定義的錯誤。RefersToRange 我從here得到了這個例子,並在成功之前使用了它。對象定義錯誤與指定命名範圍數組
我仍然試圖找出爲什麼這個錯誤顯示出來,我似乎已經用完了想法,任何人都可以幫助我指向正確的方向將真正節省我很多 代碼低於 這裏是代碼
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
感謝您的幫助 斯蒂芬
您的代碼段將無法編譯。在「狀態」前需要一個「Dim」。 –