为什么显示编译错误找不到项目vba?

时间:2020-03-23 19:19:55

标签: excel vba

我需要帮助来调整我的代码(将数据从用户表单转移到工作表中
它告诉我错误编译找不到项目库,然后坐在这个单词“ trim”上

Private Sub ButtonNew_Click()
    Dim Ad As String
    Dim c As Integer
    Dim xx As Long
    ''''''''''''''''''''
    For c = 1 To ContColmn
        Ad = Cells(1, c).Address(0, 0)
        If Len(Trim(Me.Controls(Ad).Value)) = 0 Then
           MsgBox "address: " & Me.Controls("xx" & c).Caption & " empty", vbCritical + vbMsgBoxRight + vbMsgBoxRtlReading, "empty cell"
           Me.Controls(Ad).SetFocus
            Exit Sub
      End If
    Next
    ''''''''''''''''''''''
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    With Sheet2
        Lr = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
        For c = 1 To ContColmn
            Ad = Cells(1, c).Address(0, 0)
            .Cells(Lr, c).Value = Me.Controls(Ad).Value
        Next
    End With
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
    A1.Value = Application.WorksheetFunction.Max(Sheets(2).Range("A2:A5000")) + 1
    MsgBox "ok"
    End Sub

0 个答案:

没有答案
相关问题