Excel 2010 VBA自动填充整个列 [英] Excel 2010 VBA Autofill entire column

查看:611
本文介绍了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))

这篇关于Excel 2010 VBA自动填充整个列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆