Sum function in VBA
I have a problem with summing cells in vba. I need to use Cells(a,b): Range("A1").function="=SUM(Range(Cells(2,1),Cells(3,2)))" but it doesn't work. Function is not a property/method from range. If you want to sum values then use the following: Range("A1").Value = Application.Sum(Range(Cells(2, 1), Cells(3, 2))) EDIT: if you want the formula then use as follows: Range("A1").Formula = "=SUM(" & Range(Cells(2, 1), Cells(3, 2)).Address(False, False) & ")" 'The two false after Adress is to define the address as relative (A2:B3). 'If you omit the parenthesis clause or write True instead, you can