View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default drop down list issue

Maybe...

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$I$16" Then
If LCase(Target.Value) = "whatyoudon'twanthere" Then
'do nothing
Else
If Target.Value < "" Then
'stop the change from firing this event
Application.EnableEvents = False
Cells(17, 7) = Cells(17, 7) & "" & Target.Value
Target.ClearContents
Application.EnableEvents = True
End If
End If
End If
End Sub




Calle wrote:

I have a drop down list using the validate list option.
When I select a product from the dro down list it excel display my choices
in a cell using a simple VBA script. But there is one product in the list
that I don't want to be displayed in that cell. How do I make an exeption for
that cell?

This is the script I am using now:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$I$16" Then
If Target < "" Then
Cells(17, 7) = Cells(17, 7) & "" & Target
Selection.Offset(0, 0).ClearContents

End If
End If
End Sub


--

Dave Peterson