0

在我的 UserForm Initialize 上,我有以下代码,但收到“运行时 1004:对象 _Worksheet' 的方法范围失败”错误,但它没有指定哪一行。 我还在下面列出了我的公式。

Private Sub UserForm_Initialize()
Dim own As Range
Dim agr As Range
Dim serv As Range
Dim stat As Range
Dim ws As Worksheet
Set ws = Worksheets("DropDown")

For Each own In ws.Range("ownerlist2")
  With Me.Ownercb
    .AddItem own.Value
  End With
Next own

For Each agr In ws.Range("agrlist2")
  With Me.AGRcb
    .AddItem agr.Value
  End With
Next agr

For Each serv In ws.Range("servicelist2")
  With Me.TOScb
    .AddItem serv.Value
  End With
Next serv

For Each stat In ws.Range("statuslist2")
  With Me.Statuscb
    .AddItem stat.Value
  End With
Next stat

End Sub


ownerlist2:
**=OFFSET(DropDown!$A$2,0,0,COUNTA(DropDown!$A:$A)-1,1)**

arglist2:
**=OFFSET(DropDown!$B$2,0,0,COUNTA(DropDown!$B:$B)-1,1)**

servicelist2:
**=OFFSET(DropDown!$C$2,0,0,COUNTA(DropDown!$C:$C)-1,1)**

statustlist2:
**=OFFSET(DropDown!$D$2,0,0,COUNTA(DropDown!$D:$D)-1,1)**
4

1 回答 1

0

我发现我需要将公式范围更改为正确的工作簿

于 2021-03-13T17:50:02.530 回答