command button to calculate two cell values?

S

sunil5

Hi,

Probably an easy one for most...

I've got a command button and I would like it so when I press it, i
calculates the values in cells "D8" and "D9" and puts the total i
"D10"


Any help would be much appreciated.

Thanks
 
T

Tom Ogilvy

Private Sub CommandButton1_Click()
Range("D10").Value = Range("D8").Value + _
Range("D9").Value
End Sub
 
A

anilsolipuram

In the design mode double click the button

and paste this code

Private Sub CommandButton1_Click()
Range("d10").Value = Range("d8").Value + Range("d9").Value
End Sub
 
S

sunil5

Oh thanks for that- i was trying to use the Range command but not
properly.

Cheers again :)
 

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