VBA Totaling

  • Thread starter Thread starter Steved
  • Start date Start date
S

Steved

Hello from Steved

Please how does one tell Cell G9 to add Cells G6 and G7 minus G8 to give the
answer in Visual Basic Application.

Thankyou.
 
Not too hard...
Sub AddThemUp()
Dim dblAnswer As Double
dblAnswer = Range("G6").Value + Range("G7").Value - Range("G8").Value
Range("G9").Value = dblAnswer
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Steved"
wrote in message
Hello from Steved

Please how does one tell Cell G9 to add Cells G6 and G7 minus G8 to give the
answer in Visual Basic Application.

Thankyou.
 
Here's another way:

Sub AddThemUp1()
Range("G9").Formula = "=Sum(G6,G7,-G8)"
End Sub
 

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

Back
Top