Calculating a running total of ticket sales in VBA

snowthedirtbub

New Member
Joined
Oct 29, 2013
Messages
5
I'm trying to calculate a running total of ticket sales with 5 different groups (adult, youth, senior day, senior night, and child) to where once the number of tickets are bought it will update automatically. I enter the tickets in cells B5-B9 where it then calculates the amount due and the change due. I need to put the running total in cells B18-B22. I've been stuck on this for 3 hours now and any help would be appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try this code. Put in the sheet where you need to do this. (Right click on sheet tab and click View Code. In the Project Explorer double click in the sheet's name and put this code)

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Count As Long
On Error Resume Next


Select Case Target.Address
Case "$B$5"
Count = Range("$B$18").Value
Count = Count + Range("$B$5").Value
Range("$B$18").Value = Count

Case "$B$6"
Count = Range("$B$19").Value
Count = Count + Range("$B$6").Value
Range("$B$19").Value = Count

Case "$B$7"
Count = Range("$B$20").Value
Count = Count + Range("$B$7").Value
Range("$B$20").Value = Count


Case "$B$8"
Count = Range("$B$21").Value
Count = Count + Range("$B$8").Value
Range("$B$21").Value = Count

Case "$B$9"
Count = Range("$B$22").Value
Count = Count + Range("$B$9").Value
Range("$B$22").Value = Count




End Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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