+ Reply to Thread
Results 1 to 4 of 4

drop down box activated and filled by another's action

Hybrid View

  1. #1
    Registered User
    Join Date
    05-29-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    drop down box activated and filled by another's action

    Hi All,

    I sort of new to VBA so please bear with me...

    I need a drop down box with yes/no as the choices - that bits easy - and when "yes" is picked I need another drop down to be filled (that too seems OK using something like =INDIRECT(VLOOKUP(A2,namelookup,2,0)) in the list, source of the Data>Validation menu choice).

    But this setup isn't perfect - the picking of "yes" (from the first drop down) causing the filling of the second drop-down doesn't automatically display the second ddb and make it become active (the user needs to know its there).

    I have found some code that sounds appropriate, but have no idea where this should be installed or what it should do...

    If Cells(1,1).Value = "Yes" then
      'do what you want if they chose yes
    else
      'do what you want if they chose no
    end if
    bbw. the reference to Cells sounds strangely cryptic - I assume this is instead of A1 excel cell references.

    Any help/suggestions would be greatly appreciated.

    Thanks, Roy
    Last edited by teylyn; 05-29-2010 at 06:16 AM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: drop down box activated and filled by another's action

    roytom,

    welcome to the forum. Please take a look at the forum rules, especially with regards to code tags when posting code.

    I'll add the tags for you this time, but expect you to use them from now on.

    With regards to your question, you can use dependent data validation as outlined here: http://www.contextures.com/xlDataVal02.html

    I don't quite understand your statement
    the picking of "yes" (from the first drop down) causing the filling of the second drop-down doesn't automatically display the second ddb and make it become active (the user needs to know its there).
    You may want to post a sample workbook with dummy data that illustrates your issue.

    PS: the Cells() syntax is: Cells(rowIndex, columnIndex)
    so, Cells(1, 1) is A1 and Cells(3, 5) is ....













































    E3

    cheers
    Last edited by teylyn; 05-29-2010 at 06:19 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: drop down box activated and filled by another's action

    instesd of
    =INDIRECT(VLOOKUP(A2,namelookup,2,0))

    did you try
    =indirect(A2)

    I am attaching a sample sheet (sheet1) and see the text box therein

    this solution is based on
    http://www.contextures.com/xldataval02.html
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-29-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: drop down box activated and filled by another's action

    Hi to teylyn and venkat1926 - many thanks for the help and advice - I'm having a look at the suggestions, they look really useful - if it could be done without programming that would be great. I'll have a look at =indirect as suggested. The attached speadsheet is most helpful.

    Thanks again,
    Roy

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1