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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,215,671
Messages
6,126,131
Members
449,293
Latest member
yallaire64

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