Mourning the loss of our friend, WhitPhil.
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Business Applications
Tag Cloud
access audio blue screen boot bsod connection crash dell desktop driver dvd email error excel firefox hard drive hardware hijackthis internet keyboard laptop malware monitor motherboard network networking outlook problem processor ram recovery router safe mode screen slow sound spyware tdlwsp.dll trojan upgrade vba video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: excel updating calulations

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

 
Thread Tools
scouse13's Avatar
Junior Member with 12 posts.
 
Join Date: Oct 2009
30-Oct-2009, 08:31 AM #1
Solved: excel updating calulations
is the following possible, if so what code would i use

i have a box on a worksheet for entering a value, and a second box that i want to keep as a running total, when a value is entered in the first box, i would like the second box to update with the first figure, if another value is entered in the first box the second box needs to add that to the first figure and update.
turbodante's Avatar
Senior Member with 365 posts.
 
Join Date: Dec 2008
Location: GMT 00.00 UK
30-Oct-2009, 10:45 AM #2
Is this what you meant?

Needs to go into the sheet's (code)

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim wb As Workbook, ws As Worksheet
    Set wb = ThisWorkbook
    Set ws = wb.Worksheets("sheet1")
    
If Not Intersect(Target, Range("G7")) Is Nothing Then
ws.Range("H7").Value = ws.Range("H7").Value + ws.Range("G7").Value
End If
        
End Sub
turbodante's Avatar
Senior Member with 365 posts.
 
Join Date: Dec 2008
Location: GMT 00.00 UK
30-Oct-2009, 11:48 AM #3
Thanks for PM, scouse.

In the above, what I meant by sheet's (code) is...

In VBA, you will normally see your code in a Module. In this instance, we want to put this code in the sheet. Double click on the sheet on lefthand project window, and paste the code above.

The code used cells H7 and G7, where H7 will be updated whenever G7 is changed.

If anyone this is still unclear, please shout.
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 4,511 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
31-Oct-2009, 03:12 PM #4
turbodante, is the ws reference to the housed worksheet?
turbodante's Avatar
Senior Member with 365 posts.
 
Join Date: Dec 2008
Location: GMT 00.00 UK
02-Nov-2009, 03:54 AM #5
Quote:
Originally Posted by Zack Barresse View Post
turbodante, is the ws reference to the housed worksheet?

I see what you're hinting at Zack. Both ws and wb are unneccessary.
Reply Bookmark and Share

Tags
calculations

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 03:25 AM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.