ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Totaling (https://www.excelbanter.com/excel-programming/407931-vba-totaling.html)

Steved

VBA Totaling
 
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.

Jim Cone

VBA Totaling
 

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.

Jim May

VBA Totaling
 
Here's another way:

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

"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.




Steved

VBA Totaling
 
Hello from Steved

I thankyou Both.

"Steved" wrote:

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.



All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com