Consulting

Results 1 to 5 of 5

Thread: Dependent between 2 dropdown columns

  1. #1

    Dependent between 2 dropdown columns

    Hi All,

    Can any body provide solution for the below requirement.

    In excel i have 2 dropdown column, ColumnA - State, ColumnB - Language, If i Select Karnataka in State , Language should be select Kannada


    State Language
    Karnataka Kannada
    Tamil Nadu Tamil
    Andra Telugu
    Delhi Hindi
    Kerala Malayali
    Dependency.xlsx
    Attached Excel file for your reference.

    Regards,
    Anantha

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    Do you need a drop down in column B?
    in B2:
    =VLOOKUP(A2,Sheet2!$A$1:$B$5,2,FALSE)
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Quote Originally Posted by p45cal View Post
    Do you need a drop down in column B?
    in B2:
    =VLOOKUP(A2,Sheet2!$A$1:$B$5,2,FALSE)
    Hello p45cal,

    Thanks for your response, i dont want to keep formula in the cell, i want to select from the dropdown even in Column B.

    Regards,
    Anantha

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    See code in Sheet1's code-module in the attached.
    It will work on the entire column A/B of Sheet1, whether or not there's a dropdown in either column A or B, but only if it detects one of the countries in the table.

    This is the code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim ColumnACells As Range
    Set ColumnACells = Intersect(Columns(1), Target)
    If Not ColumnACells Is Nothing Then
      For Each cll In ColumnACells.Cells
        zzz = Evaluate("VLOOKUP(""" & cll.Value & """,Sheet2!$A$1:$B$5,2,FALSE)")
        If Not IsError(zzz) Then cll.Offset(, 1) = zzz
      Next cll
    End If
    End Sub
    Attached Files Attached Files
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    Hi p45cal,

    Thank you so much.

    Regards,
    Anantha Krishna

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •