简体   繁体   English

VBA Excel-复制,粘贴带偏移的循环

[英]VBA Excel - copy, paste loop with offset

I am new to VBA and need some help - if anyone could help me. 我是VBA的新手,需要帮助-如果有人可以帮助我。

I need to copy a range, say A1:F1, and paste it in the row directly under, so A2:F2, on an automatic loop. 我需要复制一个范围,例如A1:F1,然后将其粘贴到自动循环正下方的行中,即A2:F2。

The top-most row contains data from a different sheet, therefore I will be copying the formulas of that row which links to the secondary sheet. 最上面的行包含来自不同工作表的数据,因此,我将复制链接到辅助工作表的该行的公式。 I would like the loop to end once the other sheet has been exhausted and the macro hits an empty row from the sheet. 我希望循环在其他工作表用完之后结束,并且宏从工作表中击出空行。

Any ideas? 有任何想法吗?

You can use a do until loop to find the length of your list. 您可以使用直到直到循环来查找列表的长度。 Then u can use this index to use range, push down the data and push your new data on the now empty top row. 然后,您可以使用该索引来使用范围,下推数据并将新数据推到现在为空的第一行。

I understand, that u want to push data always in the first row and everything else down, so you add always one new row. 我了解,您想始终将数据推入第一行,而将其他所有数据推入下游,因此您总是添加一个新行。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM