[英]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.