Hi All
I have run into a bit of a problem with my current sub/macro.
What I am trying to do is have a message box pop up to 'warn' the user about a certain condition that appplies. As an example product 1 might have a condition whereas product 2 doesnt have a condition. All products are listed in a dropdown list. The selection of product 1 brings up the message box. The way I have configured the unique identifier of a condition is a logical operation in cell d3 which is =IF(COUNTIF(Sheet2!J:J,TRIM(first_name))>0,1,"") first_name is where the dropdown list is located
so as a flow of the process is the following - user select via drop down list in turn selection triggers the formula in D3. In turn D3 "SHOULD" trigger the msg box only once
While the code I have works, every time the sheet (or another cell beside D3) updates it displays the message box. What I would like the code to do is only display the message when D3 changes AND only in the first instance. I have tried inserting it into the module but can only get it to work in the objects/private sub. The code is the following
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim myCell As Range
For Each myCell In Range("D3")
If (Not IsEmpty(myCell)) And myCell.Value <> 17521 And myCell.Value <> "" Then
MsgBox "This Selection has special conditions please check before proceeding.", vbExclamation
Else
Exit Sub
End If
Next myCell
Application.ScreenUpdating = True
End Sub
I have run into a bit of a problem with my current sub/macro.
What I am trying to do is have a message box pop up to 'warn' the user about a certain condition that appplies. As an example product 1 might have a condition whereas product 2 doesnt have a condition. All products are listed in a dropdown list. The selection of product 1 brings up the message box. The way I have configured the unique identifier of a condition is a logical operation in cell d3 which is =IF(COUNTIF(Sheet2!J:J,TRIM(first_name))>0,1,"") first_name is where the dropdown list is located
so as a flow of the process is the following - user select via drop down list in turn selection triggers the formula in D3. In turn D3 "SHOULD" trigger the msg box only once
While the code I have works, every time the sheet (or another cell beside D3) updates it displays the message box. What I would like the code to do is only display the message when D3 changes AND only in the first instance. I have tried inserting it into the module but can only get it to work in the objects/private sub. The code is the following
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim myCell As Range
For Each myCell In Range("D3")
If (Not IsEmpty(myCell)) And myCell.Value <> 17521 And myCell.Value <> "" Then
MsgBox "This Selection has special conditions please check before proceeding.", vbExclamation
Else
Exit Sub
End If
Next myCell
Application.ScreenUpdating = True
End Sub