Inserts a formula in cell A11 of a worksheet that calculates the sum of the values in the range A2:A10 using the Excel application's SUM function : Formula « Excel « VBA / Excel / Access / Word






Inserts a formula in cell A11 of a worksheet that calculates the sum of the values in the range A2:A10 using the Excel application's SUM function

 
Sub formal()
    Dim formulaString As String
    formulaString = "=SUM($A$2:$A$10)"
    Cells(11, "A").Formula = formulaString
End Sub

 








Related examples in the same category

1.Fill formula to cell
2.Use [] to evaluate formula
3.Is active cell empty
4.Two ways you can use Evaluate to generate a reference to a Range object, and assign a value to that object
5.The Evaluate method can also be used with arrays.
6.Assigns the values 101 to 200 to the range B1:B100, and again does it more efficiently than a For...Next loop
7.Use Copy and Paste or AutoFill functions
8.Create a set of related formulas in a column: use a looping structure to iterate through the cells that receive the formula