Excel的VBA。 移动公式而不复制它们
我有以下代码从我的macros,它工作正常:
.Cells(curRow, "M").Copy .Range("N" & curRow & ":R" & curRow).PasteSpecial Paste:=xlPasteFormulas
我想问问是否有一种方法来移动公式而不复制粘贴它们? 我需要他们改变引用移动。
我假设复制粘贴不是最快的方法。
如果你想改变引用,我知道的唯一方法是复制和粘贴。 如果你不想这样做,你可以使用:
.Range("N" & curRow & ":R" & curRow).FormulaR1C1 = .Cells(curRow, "M").FormulaR1C1
.Range("N" & curRow & ":R" & curRow).Cells.Formula = .Cells(curRow, "M").Formula
尝试这个
.Cells(curRow, "M").Copy .Range("N" & curRow & ":R" & curRow)