• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Drop down lists + If

Kobe

New Member
Hi,

Lets say I have in cell A2 a drop down list with 3 items: Red, Blue, Yellow.
I want to do the following:

In cell B2: if "Red" was chosen in A2, then in B2 the word "Yes" will appear.
if "Blue" was chosen in A2, then in B2 the word "No" will appear.
If "yellow" was chosen in A2, then in B2 the user will be prompted to CHOOSE from a drop down list that has "Yes" and "No" in it.

Is it possible? How?

Thanks!
 
Only slightly... would prefer a non-VBA solution, but if it doesn't exist then VBA it is...
 
Hi:

May be something like this

Code:
Sub test()
Application.ScreenUpdating = False

strg = "$F$1:$F$2"

With Sheet1
    If .Range("A1") = "Red" Then
        .Range("B1").Validation.Delete
        .Range("B1") = "Yes"
    ElseIf .Range("A1") = "Blue" Then
        .Range("B1").Validation.Delete
        .Range("B1") = "No"
    ElseIf .Range("A1") = "Yellow" Then
        With .Range("B1")
            .ClearContents
            .Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
            Operator:=xlBetween, Formula1:="=" & strg
        End With
    End If
End With

Application.ScreenUpdating = True
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A1")) Is Nothing Then
test
End If
End Sub

Thanks
 

Attachments

  • Book1 (Recovered).xlsm
    16.4 KB · Views: 1
Back
Top