Budget

Brad L

New Member
Joined
Feb 5, 2009
Messages
34
I have total income for month in A1.

All of my budgeted expenses are listed in B3-B20, with ACTUAL expenses to be plugged in to respective C column cells (3-20).

As I plug in each ACTUAL expense into column C (as they come in throughout the month), I want them deducted from the income value in A1, and for A1 to show the new decremented value.

Thank you!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I would also like to color the cells for each expense at the end of the month, GREEN for surplus, RED for deficit
 
Upvote 0
Try this: right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("C3:C20")) Is Nothing Then
    Application.EnableEvents = False
    Range("A1").Value = Range("A1").Value - Target.Value
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Via PM

Hi Peter:

The following code works great, except that if I go back and delete an ACTUAL value from one of the C column expenses (ex:..if I made a mistake), it does NOT alter the A1 value (ie: it remains decremented)

Thanks so much!

Try changing the code to

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("C3:C20")) Is Nothing Then
    Application.EnableEvents = False
    If Target.Value = "" Then
        Application.Undo
        Range("A1").Value = Range("A1").Value + Target.Value
        Target.ClearContents
    Else
        Range("A1").Value = Range("A1").Value - Target.Value
    End If
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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