+ Reply to Thread
Results 1 to 4 of 4

How do I use a drop down validation from within a macro

  1. #1
    Registered User
    Join Date
    07-22-2006
    Posts
    16

    How do I use a drop down validation from within a macro

    I am familiar with data validation using a list and have some vba experience but I cannot fathom out how to effectively have a drop down list within a macro.

    What I want to do at a point in the macro is show a list from which i select one item to use in the macro. Ideally I want to use the captured item to lookup a second field to then put in a specific cell.

    Any ideas would be appreciated.

    Thanks

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Auto open dropdown menu

    Hi, I don't know what you mean by having a dropdown list in a macro...

    here's code that opens a dropdown when the cell is selected

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-22-2006
    Posts
    16
    Thanks, but I am not sure that's what I meant.

    On running a macro doing a number of actions I want the macro to call for some input, but to be from a predetermined list, as if it were on a dropdown menu created using data validation. Hope this is clearer!

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524
    Hmmmmmmmm.....
    Maybe you are talking about a userform, with a combo box

    On sheet1 enter some values in cells A1:A5

    go too vba(Alt F11)
    insert userform
    insert a combobox
    double click on the combobox and insert this code
    Please Login or Register  to view this content.
    Insert a regular module then paste this code there

    Please Login or Register  to view this content.
    go to the forms tool bar and select and draw a button on the sheet, right click on the button and select assign macro
    select the UsereForm1Show macro
    and then OK

    click the button and the userform should show,
    hit the down arrow on the combo Box ,select a value and that value will show on B1

    Obviously, this is just an example, but you can now use the codes to do your own thing
    Last edited by davesexcel; 08-11-2007 at 01:18 PM.

+ 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