Tavasan65
asked on
Popup window in excel 2007
A spread sheet where I have a drop down list and if the selection in column C is "independent" I will need a popup window stating that column H must be filled by user.
Assuming you are using a Data Validation drop down list for Column C, add this code to the appropriate Sheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cel As Range
Dim MsgString As String
Dim CellCount As Long
If Not Intersect(Me.UsedRange, Me.[c:c], Target) Is Nothing Then
MsgString = "For the following cells, make sure to populate Column H:" & Chr(10)
For Each cel In Intersect(Me.UsedRange, Me.[c:c], Target).Cells
If LCase(cel) = "independent" Then
MsgString = MsgString & Chr(10) & cel.Address(False, False)
CellCount = CellCount + 1
End If
Next
If CellCount Then MsgBox MsgString, vbInformation, "Reminder!"
End If
End Sub
ASKER
these are very close. what if you have another column U that is dependent on the text "Termination" that will require column V and column W to be filled with dates.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
The above code must be installed in the code pane for the worksheet being watched. It won't work at all if installed anywhere else.
As posted, the code watches cells C2:C10 for a user-selection of "Independent". If it occurs, then the code checks whether column H already has a value. If not, then a pop-up message is displayed.
WatchValidationSelectionQ2731298.xlsm