how to specify Pop up settings?

peter85

New Member
Joined
Sep 2, 2006
Messages
9
Today I made pop-ups in my sheet, the only irritating thing is that they pop-up each time a cell in the worksheet is changed..
this is the code I used:



Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Pop Up").Activate
Set Target = Range("C4")
If Target = "Shortage" Then
MsgBox "Attention! Shortage on Brackets, Inform Supervisor Immediately!"
End If


Worksheets("Pop Up").Activate
Set Target = Range("C5")
If Target = "Shortage" Then
MsgBox "Attention! Shortage on P/UP Cable, Inform Supervisor Immediately!"
End If

Worksheets("Pop Up").Activate
Set Target = Range("C6")
If Target = "Shortage" Then
MsgBox "Attention! Shortage on Skew Screw, Inform Supervisor Immediately!"
End If


End Sub

How can I change it this way, I only want the pop-up to occur when the value in cells C4,C5 or C6 show "Shortage"..
I also want the pop-up to show up when the workbook is opened..
 
Code:
Dim popup As Boolean

If Range("c4") = "Shortage" Then
   popup = True
ElseIf Range("c5") = "Shortage" Then
   popup = True
ElseIf Range("c6") = "Shortage" Then
   popup = True
Else
   popup = False
End If
If popup Then
   MsgBox "Attention! Shortage on Brackets, Inform Supervisor Immediately!", vbOKOnly
End If
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Thanks for your efforts, now this is the formula I have:

Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Pop Up").Activate
Dim popup As Boolean

If Range("c4") = "Shortage"
popup = True
elseIf Range("c5") = "Shortage"
popup = True
elseIf Range("c6") = "Shortage"
popup = True
Else
popup = False
End If
if popup
MsgBox "Attention! Shortage on Brackets, Inform Supervisor Immediately!", vbOKOnly
End If


End Sub

however I still get the same error, suggestions?
 
Upvote 0
Yes... the "THEN" statement is missing from the If/ELSEIF lines..

Cut and paste the code directly (I had made the change after you got it)
 
Upvote 0
Try

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Pop Up").Activate
Dim popup As Boolean

If Range("c4").Value = "Shortage" Then
popup = True
ElseIf Range("c5").Value = "Shortage" Then
popup = True
ElseIf Range("c6").Value = "Shortage" Then
popup = True
Else
popup = False
End If
If popup Then
MsgBox "Attention! Shortage on Brackets, Inform Supervisor Immediately!", vbOKOnly
End If
End Sub

P.S. I tested Norie's code and it worked perfectly. Note that it is case-sensitive if you enter shortage it won't trigger a MsgBox.
 
Upvote 0
When I use this code, I still get the msgbox with each file in the sheet I change, however I only get the msgbox from the first shortage, not from the other 2 anymore...
 
Upvote 0
Code:
Strange indeed...  ok.. try this

Dim popup As Boolean 
popup = FALSE

If Range("c4") = "Shortage" Then 
   popup = True 
ElseIf Range("c5") = "Shortage" Then 
   popup = True 
ElseIf Range("c6") = "Shortage" Then 
   popup = True 
End If 
If popup Then 
   MsgBox "Attention! Shortage on Brackets, Inform Supervisor Immediately!", vbOKOnly 
End If
 
Upvote 0
Could you please explain exactly what you want to do?

Which sheet/range do you want to monitor?

By the way you do realize that the Target parameter passed to the code is the range that has been changed.
 
Upvote 0
Well I would like to simplify it a bit. I would like it that if one assigned cell (let's say C3) shows the word ''Shortage", a pop-up occurs once, at the moment the pop-up occurs each time a cell in the worksheet is entered data... I also want this pop-up to occur when I'm working in a different worksheet and data in this sheet is linked to the "pop-up sheet" and triggers cell C3 to change into "Shortage"
 
Upvote 0

Forum statistics

Threads
1,225,066
Messages
6,182,655
Members
453,130
Latest member
alexos

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