spat82
09-20-2012, 05:01 AM
Hi, I want a pop up message to appear when a user selects recharge client from a drop down field.
However, the message is currently appearing every time they change anything else on the sheet when that criteria is met.
I can get this to work on one cell, but cannot get it to work on a range of cells.
This is my current code
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D9")) Is Nothing Then Exit Sub
If Range("E9").Value = 1 Then MsgBox "Please fill out Recharge Form", vbExclamation
End Sub
I currently use the following if statement (in cell E9)to get this to work.
=if(D9="Recharge Client",1,0)
This works on when D9 is changed, but I would like it to work if anything in Column D is changed? So something like this (although I know this is very wrong)
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
If Range("E:E").Value = 1 Then MsgBox "Please fill out Recharge Form", vbExclamation
End Sub
First post and beginner on VBA, any help much appreciated! Apologies for my somewhat crude code also
However, the message is currently appearing every time they change anything else on the sheet when that criteria is met.
I can get this to work on one cell, but cannot get it to work on a range of cells.
This is my current code
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D9")) Is Nothing Then Exit Sub
If Range("E9").Value = 1 Then MsgBox "Please fill out Recharge Form", vbExclamation
End Sub
I currently use the following if statement (in cell E9)to get this to work.
=if(D9="Recharge Client",1,0)
This works on when D9 is changed, but I would like it to work if anything in Column D is changed? So something like this (although I know this is very wrong)
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
If Range("E:E").Value = 1 Then MsgBox "Please fill out Recharge Form", vbExclamation
End Sub
First post and beginner on VBA, any help much appreciated! Apologies for my somewhat crude code also