Please help: How to make a button to show the sum?

R

raymondinuk

hi,

In my excel, I would like to make a button which could show the sum o
certain cells, say, E3 to E6, after pressing it. I am wondering if i
is made by VBA? If yes, how?

I would very much appreciate your help if you could help me figure ou
this problem
 
D

Debra Dalgleish

If you select two or more cells that contain numbers, you can see the
sum in the status bar, at the bottom right of the Excel window.

Right-click on the AutoCalculate area of the status bar, and you can
choose from a list of summary functions.
 
R

raymondinuk

Dear Debra,

Thank you for your prompt answer. I have learned another skill fro
your answer but I am afraid I didn't make my problem clear.

What I want to do is to put a button on the worksheet name
"calculate". After pressing this button, I want a dialogue box to po
up and show the sume of certain cells. I think this may need VBA o
macro but I don't know how to figure it out. Need your help again.

Many thanks.
 
D

Debra Dalgleish

You could use a macro like this:

Sub SumCells()
MsgBox WorksheetFunction.Sum(Range("E3:E6"))
End Sub
 
G

Gord Dibben

raymond

Alternate with non hard-coded selection.

Sub Sum_Range()
Set rng = Selection
MsgBox WorksheetFunction.Sum(rng)
End Sub

Gord Dibben Excel MVP
 
Top