Excel ?

sdc1234

Board Regular
Joined
Mar 17, 2011
Messages
122
I have 2 seperate fields, daily and cumulative, I am trying to put a # in the daily and it will add on the the cumulative... any thoughts...
 
For the reasons mentioned previously, I strongly discourage this, but this is the code you need for it to run automatically.

This code is installed differently, right click on your sheet/tab name, click View Code. paste this code there, close the VBE window.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Range("A:A"), Target) Is Nothing Then Exit Sub
Dim MySum As Long
MySum = Range("B1").Value
Range("B1") = MySum + Range("A1").Value

End Sub
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Range("G:G"), Target) Is Nothing Then Exit Sub
Dim MySum As Long
MySum = Range("H27").Value
Range("H27") = MySum + Range("G15").Value

End Sub
</pre>
 
Upvote 0
This will do what you need, to use it, right click on the sheet tab you want it to run on and click view code. Then copy/paste the following code into that window:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("G15")) Is Nothing Then
    Range("H27").Value = Range("H27").Value + Target.Value
End If
End Sub
 
Upvote 0
it worked thank u, when I click on the cell it adds it again even after I have typed it in: say I had the daily on 5 and it added 5 to the running which is fine but the next guy anly has 4 and clicks on the daily, it added a total of 9, is there any way to prevent this..
 
Upvote 0
it worked thank u, when I click on the cell it adds it again even after I have typed it in: say I had the daily on 5 and it added 5 to the running which is fine but the next guy anly has 4 and clicks on the daily, it added a total of 9, is there any way to prevent this..

Use the Worksheet_Change macro I provided. The selection_change will fire every time you move your cursor over column G.
 
Upvote 0
I want to merge specific cells on 3 different spreadsheets to 1 main spreadsheet, I have tried consolidate but still not working any thoughts...

thx
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top