[英]Excel VBA Autofill Multiple Unqiue Columns
I have 420 columns, each with a unique formula that changes by row number, with about 1500 rows in total.我有 420 列,每列都有一个根据行号变化的独特公式,总共大约有 1500 行。
For reasons I can't understand, the row number references in each forumla doesn't always update correctly when I'm refreshing the data query (from sharepoint list).由于我无法理解的原因,当我刷新数据查询(来自 sharepoint 列表)时,每个论坛中的行号引用并不总是正确更新。 However this only happens far down the sheet.
然而,这只发生在表的下方。
I can write a VBA script to autofill each column from the top cell to fix this;我可以编写一个 VBA 脚本来自动填充顶部单元格中的每一列来解决这个问题;
Range("A2").Select
Selection.AutoFill Destination:=Range("A2:A1555")
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B1555")
But this means repeating until column PD, a lot of typing.但这意味着要重复直到 PD 列,需要大量输入。
Is there a more dynamic way to do this?有没有更动态的方法来做到这一点? The number of columns should never change, however the total number of rows likely will.
列数永远不会改变,但总行数可能会改变。
You could do it like this in one operation:您可以在一次操作中这样做:
Range("A2").Resize( , 420).AutoFill _
Destination:=Range("A2").Resize(1554, 420)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.