简体   繁体   English

Excel VBScript复制和粘贴单元格值到另一个列表的末尾

[英]Excel VBScript Copy and Paste cell values to end of another list

I have a table with cell values and would like to copy them to a range on another worksheet. 我有一个包含单元格值的表,并想将它们复制到另一个工作表上的范围。 The script below is working for the copy and paste part, but I would like to have the information paste to the end of the list each time and not overwrite information already there. 下面的脚本适用于复制和粘贴部分,但是我希望每次都将信息粘贴到列表的末尾,而不要覆盖那里的信息。

Set excel = CreateObject("Excel.Application")
Set info = excel.Workbooks.Open("C:\Users\jcampos\Google Drive\Standings Excel\Standings.xlsm")

info.Worksheets("XML").Range("DATA").Copy

info.Worksheets("Gameday Info").Range("A2").PasteSpecial -4163

info.save
info.Application.Quit

Is there a way to make it append to the bottom of the list instead of overwriting information? 有没有办法使它附加到列表的底部而不是覆盖信息?

Thanks 谢谢

Simply change Range("A2") to reference last row. 只需更改Range(“ A2”)以引用最后一行。

lastrow = info.Worksheets("Gameday Info").UsedRange.Rows.Count + 1
info.Worksheets("Gameday Info").Range("A" & lastrow).PasteSpecial -4163

See other ways to reference last row . 请参阅其他引用最后一行的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Excel-复制选定的单元格并粘贴到另一个工作表中列的末尾 - Excel - Copy selected cell and paste to the end of a column in another worksheet 如何将公式驱动的单元格复制并粘贴到另一个单元格中作为Excel中的值 - How to copy and Paste a formula driven cell to another cell as values in Excel 复制Excel范围并在VBScript中仅将值(pasteSpecial)粘贴为跳空白 - Copy excel range and paste only values (pasteSpecial) with skip blanks in VBScript VBA Excel-复制单元格值并将值粘贴在另一个单元格的字符之间 - VBA Excel - copy cell values and paste value in between characters of another cell excel使用另一个单元格中的地址将单元格复制/粘贴到单元格 - excel copy/paste cell to cell using address in another cell Excel宏,要基于另一个单元格值复制和粘贴单元格值? - Excel macro, to copy and paste a cell value based on another cell value? 如何使用vbscript复制粘贴并连接Excel列? - How to copy paste and concatenate Excel column with vbscript? Excel宏复制单元格范围并将数据粘贴到另一个工作表 - Excel Macro Copy cell range & paste data one sheet to another Excel VBA - 将每个单元分别复制并粘贴到另一个程序 - Excel VBA - Copy and Paste each cell Individually to another program Excel VBA - 根据数字是否在另一个单元格中复制 + 粘贴 - Excel VBA - Copy + Paste Based on Whether a Number is in Another Cell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM