+ Reply to Thread
Results 1 to 2 of 2

How to include a drop down input box in a macro

  1. #1
    Registered User
    Join Date
    03-31-2014
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2211 Build 16.0.15831.20220) 64-bit
    Posts
    5

    How to include a drop down input box in a macro

    Hi Guys, I'm fairly new to macros so any help is appreciated!
    I have written a macro to translate a column of text from any language (Auto-detected) into English - (code included below) which works fine as long as the data is in Column A, on a worksheet called 'Sheet1' which is ok.

    Now I need to include a drop-down box of a list of languages for the user to choose the output language 'outputstring'. I need to be able to use this macro on hundreds of different spreadsheets across the world, and need it quickly so how on earth do I do that? Would I need to hard-code the list of languages into the macro? How do I get the associated 2-digit code from that to use in the translator?
    Am completely blank on this, thanks in advance!
    MrsMac


    Current code:

    Please Login or Register  to view this content.

    Example of languages and codes: - I need the user to input eg. Czech from drop down list, and pass 'CS' to outputstring for translator.

    Czech CS
    Danish DA
    Dutch NL
    English EN
    Esperanto EO
    Estonian ET
    Faeroese FO
    Fiji FJ
    Finnish FI
    French FR
    Frisian FY
    Gaelic GD
    Galician GL
    Georgian KA
    German DE
    Greek EL
    Greenlandic KL

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: How to include a drop down input box in a macro

    Hi MrsMac,
    Unfortunately, the VBA InputBox does not have an option to create a dropdown.

    For what you want to achieve, you should look at a "ListBox" or a "ComboBox" on a UserForm. Userforms are fairly easy to create & code, aesthetically much more elegant than an "InputBox", and can help you create a plethora of options that interact with the spreadsheet users at run-time. Search within this forum (or simply Google for it) and you'll find plenty of good examples.

    HTH. Cheers!
    Jewel

+ 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. [SOLVED] Editing a Macro to include multiple rows and include text formatting for leading zeros
    By missmea2005 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-04-2014, 09:50 AM
  2. Macro's in an excel 2007 workbook need to include drop down formating
    By JPayne@nbri in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2013, 04:23 PM
  3. Macro Help with Input Box or Drop Down List
    By excelrcb3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2012, 10:53 AM
  4. Sort column and include data validation input message
    By JimmyA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2012, 08:18 AM
  5. Macro to (i) drag and drop & (ii) input array formula
    By JHCali in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-11-2008, 08:58 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