![](/img/trans.png)
[英]how to copy last column range and past to the next column range in excel table (dynamically)
[英]How to copy Range and past to last row
我在单元格E33:G33中有一个用户输入的交易信息(名称,金额,日期)。
用户单击按钮,交易记录在从E46:G46开始的交易历史记录列表中使用的最后一行+1中。
到目前为止,我的代码无法正常工作。
我只想:-复制范围(E33:G33)-查找E列中使用的最后一行-下移一行-粘贴复制的范围
无法找到有效的答案,请帮忙! 谢谢。
用这个:
Sub test()
Dim e&: e = Cells(Rows.Count, "E").End(xlUp).Row + 1
Range("E" & e & ":G" & e).Value = [E33:G33].Value 'past only values
End Sub
要么
Sub test2()
Dim e&: e = Cells(Rows.Count, "E").End(xlUp).Row + 1
[E33:G33].Copy Range("E" & e & ":G" & e) 'past with cells format
End Sub
要么
Sub test3()
Dim e&: e = Cells(Rows.Count, "E").End(xlUp).Row + 1
[E33:G33].Copy
Range("E" & e & ":G" & e).PasteSpecial xlPasteAll 'past with cells format
End Sub
要么
Sub test4()
Dim e&: e = Cells(Rows.Count, "E").End(xlUp).Row + 1
[E33:G33].Copy
Range("E" & e & ":G" & e).PasteSpecial xlPasteValues 'past only values
End Sub
也:
[E33:G33]
可以替换为:
Range("E33:G33")
要么
Cells(Cells(33,"E"),Cells(33,"G"))
要么
Cells(Cells(33,5),Cells(33,7))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.