Subtracting from drop down list

enriquep22

New Member
Joined
Dec 12, 2017
Messages
1
Good afternoon Folks,

I have run into a small issue using Excel. I have created a drop down list, and i'm trying to figure out how to subtract how many times a name were to come up. for example If i have 35 tickets to the movie jumanji, If i select from the drop down list Jumanji could i now get 35 to be 34? If i can please get some help with this that would be greatly appreciated.

thanks in advance,

Enrique
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Give this a go.
I assume the drop down with the movie list is in cell B2.
Cells E1, F1, G1 have the movie titles in them. My movies names are "aa", "bb", "cc".
Cells E2, F2, G2 have the number of ticket available for the respective movie names.
Selecting a movie name in B2 drop down will subtract 1 (one) from that movie ticket count, until one remains, where you will get a message, and when there is 0 (zero) tickets you will get a message.
Further selection beyond 0 (zero) will count in the negative, how many you sold?... but do not have.

Copy to the sheet module where you have the drop down with the movies.


Howard

Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target <> Range("B2") Then Exit Sub

Dim Msg, ans, Cancel
  
Select Case Target.Value

  Case "aa"
 
   [E2] = [E2] - 1
   
   If [E2].Value = 1 Then
        Msg = "One ticket remains for - " & Target
        ans = MsgBox(Msg, vbExclamation)
     ElseIf [E2].Value = 0 Then
        Msg = "NO ticket for - " & Target
        ans = MsgBox(Msg, vbExclamation)
       Exit Sub
   End If
        
  Case "bb"
  [F2] = [F2] - 1
   
   If [F2].Value = 1 Then
        Msg = "One ticket remains for - " & Target
        ans = MsgBox(Msg, vbExclamation)
     ElseIf [F2].Value = 0 Then
        Msg = "NO ticket for - " & Target
        ans = MsgBox(Msg, vbExclamation)
       Exit Sub
   End If

  Case "cc"
   [G2] = [G2] - 1
   If [G2].Value = 1 Then
        Msg = "One ticket remains for - " & Target
        ans = MsgBox(Msg, vbExclamation)
     ElseIf [G2].Value = 0 Then
        Msg = "NO ticket for - " & Target
        ans = MsgBox(Msg, vbExclamation)
       Exit Sub
   End If
   
  Case Else
    '
End Select

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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