+ Reply to Thread
Results 1 to 16 of 16

VBA to auto display drop down list when cell selected

  1. #1
    Forum Contributor
    Join Date
    08-21-2012
    Location
    London
    MS-Off Ver
    Office 365 MAC
    Posts
    107

    VBA to auto display drop down list when cell selected

    Hi folks

    As a relative newbie to VBA, with any queries I have I try a web search, forum search and then I post! I am pretty sure my issue is not unique and I am pretty sure there will be another post alredy listed... I never quite know the right phrase to enter in the search tools to find what I am looking for!

    So, after many searches which result in me going nowhere fast, I apologise for the request in advance!

    I have some data validation lists to control data quality in my spreadsheet. As with most users, in order to select a response I must firstly click in to the cell, which in turn displays the dropdown handle, then click the handle and finally make a selection from the list displayed.

    Please can you assist me with - How can I achieve an automatic display of the dropdown as soon as I click in to the relevant cell, using VBA?

    Will the code be cell specific or can it be a more holistic code, which I would imagine slows down the performance?

    I hope the fact that I am a Office for Mac user (Office 365 v16.15) does not further complicate matters... most of the users of my creation will be PC users

    Thank you in advance
    Learner, making mistakes, asking daft questions.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: VBA to auto display drop down list when cell selected

    To do this in VBA requires programming to create mouse clicks. It is complicated and in 20 minutes I could not collect enough information to determine the screen coordinates for the click.

    If you are just trying to save clicks, you could use comboboxes instead, which displays the dropdown handle all the time, and you can click directly on that.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA to auto display drop down list when cell selected

    Hi Ed

    What is the nature of your data validation?

    A List or a value within a range?
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

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

    Re: VBA to auto display drop down list when cell selected

    You can be column Specific

    Please Login or Register  to view this content.
    Or range specific

    Please Login or Register  to view this content.
    The code belongs in the worksheet module.

    RightClickTab.jpg

  5. #5
    Forum Contributor
    Join Date
    08-21-2012
    Location
    London
    MS-Off Ver
    Office 365 MAC
    Posts
    107

    Re: VBA to auto display drop down list when cell selected

    Quote Originally Posted by 6StringJazzer View Post
    To do this in VBA requires programming to create mouse clicks. It is complicated and in 20 minutes I could not collect enough information to determine the screen coordinates for the click.

    If you are just trying to save clicks, you could use comboboxes instead, which displays the dropdown handle all the time, and you can click directly on that.
    Thank you for the note about combo boxes, I have considered them. Unfortunately there are so many lines in the sheet where I want the functionality it makes the sheet look really messy.

  6. #6
    Forum Contributor
    Join Date
    08-21-2012
    Location
    London
    MS-Off Ver
    Office 365 MAC
    Posts
    107

    Re: VBA to auto display drop down list when cell selected

    Quote Originally Posted by mehmetcik View Post
    Hi Ed

    What is the nature of your data validation?

    A List or a value within a range?
    Without sounding strange, both!

    The data validation is from a table column. I have created an INDIRECT reference in the data validation to point me back to the table that holds the drop down data (so the user can amend the list at another point in time without the need for my intervention)

    Thank you for your response

  7. #7
    Forum Contributor
    Join Date
    08-21-2012
    Location
    London
    MS-Off Ver
    Office 365 MAC
    Posts
    107

    Re: VBA to auto display drop down list when cell selected

    Quote Originally Posted by davesexcel View Post
    You can be column Specific

    Please Login or Register  to view this content.
    Or range specific

    Please Login or Register  to view this content.
    The code belongs in the worksheet module.

    Attachment 584255
    Thank you for responding. Unfortunately neither set of options works. I had found another piece of code with the ("%{DOWN}") reference and the code crashed at that point.

    Using your code had no effect when I click the cells... I must be doing something wrong!

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

    Re: VBA to auto display drop down list when cell selected

    I'll do a search, maybe there is a different sendkeys for mac.
    Last edited by davesexcel; 07-31-2018 at 02:18 PM.

  9. #9
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA to auto display drop down list when cell selected

    You could use a selection change macro to open a Userform

    Right Click on your sheet name at the bottom of excel and select view code

    Paste this code into the module that opens an then close it.

    Please Login or Register  to view this content.

    Create a Userform containing a list box

    Double click on the listbox to view its code/

    replace its code with

    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    08-21-2012
    Location
    London
    MS-Off Ver
    Office 365 MAC
    Posts
    107

    Re: VBA to auto display drop down list when cell selected

    Thank you, that does indeed work, just takes time opening and closing, I do appreciate the effort though. There are literally hundreds of these dropdowns.

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

    Re: VBA to auto display drop down list when cell selected

    Apologies, l I never knew send keys did not work for mac.

    If you search "excel sendkeys mac alternative" you could get some results, I can't test them out.

  12. #12
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA to auto display drop down list when cell selected

    This Ammended Code works for Lists and Ranges

    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    08-21-2012
    Location
    London
    MS-Off Ver
    Office 365 MAC
    Posts
    107

    Re: VBA to auto display drop down list when cell selected

    Quote Originally Posted by davesexcel View Post
    Apologies, l I never knew send keys did not work for mac.

    If you search "excel sendkeys mac alternative" you could get some results, I can't test them out.
    Thank you. Does that mean it will work for my Mac but not ofr PC users though?

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

    Re: VBA to auto display drop down list when cell selected

    Yes.

    If you manually select a cell with a dropdown list and hit the Keys "Alt & Down arrow" the cell list will drop down. Application.sendkeys just does that programmatically.

  15. #15
    Forum Contributor
    Join Date
    08-21-2012
    Location
    London
    MS-Off Ver
    Office 365 MAC
    Posts
    107

    Re: VBA to auto display drop down list when cell selected

    Thank you. I am grateful for all the responses

  16. #16
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA to auto display drop down list when cell selected

    A Mash Up of Daves Solution and Mine


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Drop down list answer(s) selected to auto appear in another sheet
    By rcm4486 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-21-2017, 11:23 AM
  2. Drop down list answer(s) selected to auto appear in another sheet
    By rcm4486 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2017, 10:49 AM
  3. Display selected columns in excel based on drop down list
    By tejboyd in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-21-2017, 09:23 AM
  4. Display multiple value when item selected in drop down list
    By peter.lu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-15-2015, 05:06 PM
  5. Replies: 3
    Last Post: 01-28-2015, 01:09 AM
  6. How to display data based on a selected month from a drop-down list
    By Ahmed Ammar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-14-2014, 09:24 PM
  7. VLOOKUP Function to display entire row of value selected via drop-down list
    By BamBamMoneyBags in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-08-2013, 03:00 AM

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