繁体   English   中英

自动填充一个单元格 VBA Excel

[英]Autofill One Cell VBA Excel

我正在尝试自动填充活动行右侧的一列,但遇到了问题。 例如,I5 中有一个方程,我想要一个宏来自动填充 J5 并且只填充 J5。

谢谢,

贝卡

我从您有限的数据中推断出您需要以下解决方案。 (如果您需要更多功能,请回复详细信息。)

Public Sub FormulaPopulation()


Dim rng1 As Range
Dim rng2 As Range

Set rng1 = Sheet1.Range("J2")   ' Have assumed over here that the formula that you need autofilled is in "J2" which is an unrelated cell
Set rng2 = Sheet1.Range("J5")   ' Then since you only need this cell filled we take this cell.

rng2.Formula = rng1.Formula     ' Finally it is formula matched, rather than Autofilling. Much faster than autofill.


End Sub

暂无
暂无

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

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