hysenlici


Hi

I need help...

In my drop-down validation list when I select let's say "Apple", I want a message box to come out, only for "Apple", let's say" Attention: You selected apple. We remind you that this item..."

If I select, letí»s say "Onion" nothing should be came out.

Could someone help me with this, I think by running a private macro




Re: Validation list macro

Andy Pope


Hi,

You can put some code in the Change event of the sheet that has the data validation on it.
This assume the cell is B1.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("B1")) Is Nothing Then
If Target.Value = "Apple" Then
MsgBox "Attention: You selected apple. We remind you that this item...", vbExclamation
End If
End If

End Sub







Re: Validation list macro

hysenlici

Awesome!

This works perfectly,

Many thanks....






Re: Validation list macro

hysenlici

....but, it does NOT work with a pivot table. At all times you pick a different item, the formatting automatically changes, and excel doesn't read the new formatting. If you apply with format painter the old formatting, it works.

Can this be solved





Re: Validation list macro

srinivasanng

Hi,
I have used the same code as u told.In this case i used data validation,if there is any change the list i need to display the msgbox.Problem is it is coming for the first time i open the woorkbook.There after it is not working.is there is any alternative for worksheet_change.I used this event for many time it working for some time n its not working for some other time