Excel 2010 VBA自动填充整个列
我无法让VBA等效于自动填充整行(例如,当您双击带有公式的单元格的加号并自动填充适当的列数时).
I am having trouble getting VBA to do the equivalent of Autofilling an entire row (such as when you double click on the plus sign of a cell with a formula and it autofills the appropriate number of columns).
沿A列,我有一个日期列表.在第3行中,我有一个公式列表.如何编写可有效执行此操作的宏:
Along Column A I have a list of dates. Along Row 3 I have a list of formulas. How do I write a macro which will effectively do this:
For i = 2 to Columns.Count
'FillDown the whole of Column i with the formula in Cells(3,i)
Next i
我想要填写,而不仅仅是一个精确公式的副本...有谁知道该怎么做?到目前为止,我已经有一种方法需要花费大约20分钟的时间,但是当我手动执行此过程时,它根本不需要花费太多时间,因此我认为必须有一种更快的方法.
I want the fill down, not just a copy of the exact formula... Does anyone know how this can be done? I've got a method which is taking about 20 minutes so far but when I do this process manually it takes not very much time at all, so I think there must be a much faster way.
非常感谢您的帮助!
您可以尝试将Autofill
与目标范围一起使用.
You can try to use Autofill
with a destination range.
类似的东西:
Selection.AutoFill Destination:=Range("A2:A12")
或:
Range("A1").AutoFill Destination:=Range(Cells(1, firstColNumber), Cells(1, lastColNumber))