tags:

views:

33

answers:

1

Hi, I have an excel sheet where a column has a list validation.

When a particular entry from the list is selected, i need a message box to be popped up.

I could have used the following code if there was only 1 cell, but in my case i have many cells in a column

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim rng As Range Set rng = Range("A1") If Not Intersect(Target, rng) Is Nothing Then If rng = "hi" Then MsgBox "Cell " & _ rng.Address & " = hi" End If End If

Set rng = Nothing

End Sub

Please help

+1  A: 

examine the value of the Target.Column property ....

Suppose you want to examine column D (numeric value 4), you do

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 4 ' examine column D
    ' code to validate Target
        If Target = "xxx" Then MsgBox "You chose xxx from the list"
    End If
End Sub

Good luck MikeD

MikeD