Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 错误运行时错误-2147024809(80070057)_Vba - Fatal编程技术网

Vba 错误运行时错误-2147024809(80070057)

Vba 错误运行时错误-2147024809(80070057),vba,Vba,我对宏有一个问题,在运行宏时出现错误: Run Time Error -2147024809 (80070057) 一致 If VBA.Len(Me.Controls("Textbox" & i).Value) > 0 Then 所有代码 Dim wks As Worksheet Dim lWie As Long Dim i As Long Dim lRow As Long Set wks = ThisWorkbook.Worksheets("S

我对宏有一个问题,在运行宏时出现错误:

Run Time Error -2147024809 (80070057)
一致

If VBA.Len(Me.Controls("Textbox" & i).Value) > 0 Then
所有代码

Dim wks As Worksheet
Dim lWie As Long
Dim i As Long
Dim lRow As Long

Set wks = ThisWorkbook.Worksheets("Sheat1")

With wks
    lWie = .Cells(.Rows.Count, "A").End(xlUp).Row

    For i = 1 To 40
        If VBA.Len(Me.Controls("Textbox" & i).Value) > 0 Then
            lRow = lRow + 1
            .Cells(lWie + lRow, "A").Value = lWie + lRow - 1
            .Cells(lWie + lRow, "B").Value = .Range("P1").Value
            .Cells(lWie + lRow, "C").Value = .Range("R1").Value
            .Cells(lWie + lRow, "D").Value = Me.Controls("Textbox" & i).Value
        End If
    Next i
End With

这是错误\无效\参数。您可以尝试将该行分隔为几行,以确定是哪个特定位导致了错误:将“Textbox”与i、Me.Controls调用、结果的.Value或结果的VBA.Len连接起来。当代码出现错误时(将光标移到变量上),哪个值具有
i
?您确定有足够的文本框(从1到40)?