我只想将百分比计算为:
function output(a) {
console.log( "The function filter return " + a + "!");
}
x = function(data, fun) {
a = data;
fun(a);
};
theInput = " TEXT FROM INPUT ";
x(theInput, output);//The function filter return TEXT FROM INPUT !
这很好,因为这是静态范围。但在此之后我插入了一行:
Range("E7").Value "=(E5/(E5+E6))"
现在百分比列保持静态但我希望公式也将一行向下移动:
Range("A1").EntireRow.insert
答案 0 :(得分:0)
使用范围对象解决此问题,使用范围对象,当您插入或删除行或列时,它将移动。
Sub Answer()
Dim percentage As Range
Set percentage = Range("E7")
Range("A1").EntireRow.Insert
percentage.FormulaR1C1 = "=R[-2]C/(R[-2]C+R[-1]C)"
End Sub