簡體   English   中英

Excel中的按鈕可將信息從一張紙復制到新行的另一張紙上

[英]button in Excel to copy information from one sheet to another on a new row

宏非常新,這是我的第一個...

因此,我建立了一個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

任何幫助都非常感謝

嘗試命名您的子CommandButton1_Click(),其中CommandButton1是按鈕的名稱

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM