excel - 将数据添加到另一个表
问题描述
我在一张表中有一个表(“table1”)。我有一个按钮,可以将表中的数据添加到另一张表中的另一个表中(“表”)。每次它覆盖数据。我想将数据(“table1”)添加到表(“table2”)而不是覆盖它。这是代码:
Sheets("Letter (P V)").ListObjects("Table1").Range.Copy _
Destination:=Sheets("Actual").Range("E2")
谢谢!
解决方案
我想你想要这样的东西
Dim ws As Worksheet
Dim rangeToPaste As Range
Set ws = Sheets("Actual")
'go up from the bottom to the first row populated in column 5(E) after do +1 to paste after the last row'
Set rangeToPaste = ws.Range("E" & ws.Cells(ws.rows.Count, 5).End(xlUp).row + 1)
Sheets("Letter (P V)").ListObjects("Table1").Range.Copy Destination:=rangeToPaste
推荐阅读
- rust - 我无法构建奇偶校验基板运行时,因为未找到 wasm-gc 命令
- java - 构建 jar 文件后库(jUnique)的问题
- mysql - Dockerfile 不会从我的 initialize.sql 创建表
- excel - 如何在vba中动态使用文本框查询excel
- django - 为什么迁移后页面不显示?
- node.js - 如何在调试模式下使用 node.js ts 运行 pm2 并在 WebStorm 上中断
- java - jmap 实时堆转储如何包含无法访问的对象?
- hyperledger - 用于生产的 Hyperledger Fabric 支持
- javascript - 没有从地理服务器成功获取瓷砖
- ios - 如何在 Xcode 中更改导航栏项目(特别是按钮)的宽度?