【问题标题】:button in Excel to copy information from one sheet to another on a new rowExcel 中的按钮将信息从一个工作表复制到另一个工作表的新行
【发布时间】:2016-10-16 17:59:54
【问题描述】:

对宏非常陌生,这是我的第一个...

所以我构建了一个 Excel 表单,我们将在其中输入信息(UpScoreAudit),单击一个按钮,该信息将被复制到同一工作簿上的另一个工作表(UpScores)的新行上。我在这里搜索过,找到了一些帮助,但是当我单击按钮时没有任何反应。这是我目前拥有的:

Sub OnClick()
Dim refTable As Variant, trans As Variant
refTable = Array("A=C3", "B=C4", "C=C5", "D=C6", "E=C7", "F=C9", "G=D11", "H=D13", "J=E15")
Dim Row As Long
Row = Worksheets("UpScores").UsedRange.Rows.Count + 1
For Each trans In refTable
    Dim Dest As String, Field As String
    Dest = Trim(Left(trans, InStr(1, trans, "=") - 1)) & Row
    Field = Trim(Right(trans, Len(trans) - InStr(1, trans, "=")))
    Worksheets("UpScoreAudit").Range(Dest).Value = Worksheets("UpScores").Range(Field).Value
Next
End Sub

任何帮助都非常感谢

【问题讨论】:

    标签: excel macros


    【解决方案1】:

    尝试命名您的子 CommandButton1_Click(),其中 CommandButton1 是您的按钮的名称

    【讨论】:

    • 还是一无所获。
    猜你喜欢
    • 2018-07-22
    • 2023-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-04
    • 1970-01-01
    • 1970-01-01
    • 2012-10-21
    相关资源
    最近更新 更多