我有一個包含以下資料的 Excel 作業表:
A1:1
B1:= A1 2
A5:2
我試圖創建一個宏來將公式從 B1 復制到 B5
Sub test()
MsgBox Cells(1, 1)
Cells(5, 2) = Cells(1, 2).Formula
End Sub
但是這個宏不會改變公式單元格的值。意思是,宏復制公式= A1 2,但我希望它是= A5 2. 是否有捷徑可尋?
uj5u.com熱心網友回復:
您希望.Formula2R1C1屬性如下:
Sub copy_formula()
Range("b5").Formula2R1C1 = Range("b1").Formula2R1C1
End Sub
要么
Sub copy_formula()
Cells(5, 2).Formula2R1C1 = Cells(1, 2).Formula2R1C1
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/449912.html
上一篇:從表中洗掉特定行
