我试图仅在活动行右侧的一列中自动填充方程式,但遇到了麻烦。例如,在I5中有一个方程式,我想要一个可以自动填充J5和仅J5的宏。
谢谢
贝卡
答案 0 :(得分:0)
我从有限的数据中得出的结论是,您需要以下解决方案。 (如果您需要的功能更多,请提供详细信息。)
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