Excel VBA:错误1004。脚本之前已工作

时间:2019-03-14 11:07:44

标签: excel vba

运行数月后,脚本无处不在不断失败。有人可以检查我的脚本,如下所示:

Sub Data_Types()
    Dim MyList(200) As String
    Dim Rows_used_Componenten_Library




    Rows_used_Componenten_Library = Worksheets("Component types").UsedRange.Rows.Count


    For h = 0 To Rows_used_Componenten_Library
        MyList(h) = Worksheets("Component types").Range("A2").Offset(h, 0).Value
    Next h

    For i = 0 To 202
        With Worksheets("Component list").Range("H2").Offset(i, 0).Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=Join(MyList, ",")
        End With
    Next i

    MsgBox "Component keuze overgenomen"

    End Sub

0 个答案:

没有答案