To sum the values of the cell

S

Subodh

I want to sum up the values of cells using VBA.
Lets say from Range A10 to A100 and make it as a vary.
Also, the rows 10 and 100 are supplied by the user.
However, the follwing does not work
Dim xsum as long
i1=10
i2=100
x = sum(cells("A(i1):A(i2)")
does not works.
Can anyone help?
Thanks in advance.
 
J

Jacob Skaria

Try

Dim xsum As Variant
i1 = 10
i2 = 100
x = Application.Sum(Range(Cells(i1, "A"), Cells(i2, "A")))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top