+ Reply to Thread
Results 1 to 8 of 8

macro to pop up with drop down options

  1. #1
    Registered User
    Join Date
    07-11-2014
    Location
    Columbia SC
    MS-Off Ver
    2010
    Posts
    31

    macro to pop up with drop down options

    I have code written in vba that will prompt the user to enter additonal information if they type in a certain cell
    Please Login or Register  to view this content.
    and this in a cell that calls that function

    Please Login or Register  to view this content.
    so basically, if they type anything in C51 is will ask them for the dispostion.
    the problem is that I need it to be a drop down menu, not an input box, so they can only select a set number of responses, not just whatever they would like to type.

    I know how to make a drop down menu in a cell, but I don't know how to get it to pop up like the input box.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro to pop up with drop down options

    Hi davidmajorwhite,

    I think a UserForm with either a ComboBox or a ListBox may be a better solution. The choices in either one can be populated by either a list from a Worksheet or by code. See the attached sample workbook which implements both, and the complete code that follows:

    UserForm1 Code:
    Please Login or Register  to view this content.

    Ordinary Module Code (e.g. Module1):
    Please Login or Register  to view this content.
    I hope this helps, rather than confusing the issue.

    Lewis

  3. #3
    Registered User
    Join Date
    07-11-2014
    Location
    Columbia SC
    MS-Off Ver
    2010
    Posts
    31

    Re: macro to pop up with drop down options

    I'm sure what you wrote there could be adjusted to fit what I need but I'm not sure how to do it. I don't really want a button just the
    Please Login or Register  to view this content.
    to trigger the pop up. The list of possible entries I have in AT1:AT17.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro to pop up with drop down options

    Your formula didn't work for me in Excel 2003. I had to change iftext to isText.
    Please Login or Register  to view this content.
    I modified my code to generate a User Defined Function named 'askforresult()'. I needed two global variables, because UserForms and Spreadsheets have a hard time communicating with each other:
    a. bUserForm1IsActive - boolean variable to indicate when the UserForm is open
    b. sUserFormDisposition - string variable that saves the disposition returned from the UserForm.

    Lewis

    See the attached file and complete modified code below:
    UserForm1 code:
    Please Login or Register  to view this content.
    Ordinary module code (e.g. Module1):
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-11-2014
    Location
    Columbia SC
    MS-Off Ver
    2010
    Posts
    31

    Re: macro to pop up with drop down options

    thanks, is there anyway for it to be more simple than that, though? I'd like it to pop up with just one drop down.

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro to pop up with drop down options

    I'd like it to pop up with just one drop down.
    If I understand the question correctly, you want the UserForm to only have one selection box. There are 3 in the UserForm for demo purposes only:
    a. ComboBox that gets loaded using a range of Worksheet Cells
    b. Combobox that gets loaded using code
    c. ListBox that gets loaded using a range of Worksheet Cells (can also be loaded using code).

    The idea was for you to see the choices available, and to decide which if any you wanted to use.

    Lewis

  7. #7
    Registered User
    Join Date
    07-11-2014
    Location
    Columbia SC
    MS-Off Ver
    2010
    Posts
    31

    Re: macro to pop up with drop down options

    I'd like to go with the first option, It wont work for me as is, so I assume I need to delete a lot of it to only utilize combo box 1?

  8. #8
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: macro to pop up with drop down options

    To use ComboBox1 ONLY, delete the lines in red below from my previous post. I'm doing the 'red thing' instead of the corrected code, so you can learn to do it yourself next time.

    UserForm1 Code:
    Please Login or Register  to view this content.
    Ordinary Module Code (e.g. Module1) - no changes required.

    Lewis

+ 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. Display options from drop down
    By Reign in forum Excel General
    Replies: 0
    Last Post: 02-14-2013, 05:45 PM
  2. [SOLVED] Column B drop down list with 2 options, columns C & E with dependent drop down lists
    By betic in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-26-2012, 03:47 PM
  3. Drop down list options
    By James83 in forum Excel General
    Replies: 10
    Last Post: 04-23-2011, 07:13 PM
  4. Drop Down Menu Options?
    By ibo4lyf in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2008, 12:20 AM
  5. Drop down list. I need more options
    By cybercab in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-26-2007, 12:12 PM

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