+ Reply to Thread
Results 1 to 2 of 2

Insert ListBox Selection into a cell on spreadsheet

  1. #1
    Forum Contributor
    Join Date
    10-03-2016
    Location
    Sydney, Australia
    MS-Off Ver
    MS 365
    Posts
    128

    Insert ListBox Selection into a cell on spreadsheet

    Hi,

    I have a listbox with the alphabet in it. Is there a way that when the letter is clicked on, that letter is inserted into a specific cell on a spreadsheet?

    So when clicking on "A", the letter A is inserted into worksheet 6 (AusPost) cell $b$3, then if I click on the letter "M", $b$3 changes to the letter M.

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

    Re: Insert ListBox Selection into a cell on spreadsheet

    Hi Anarchus,

    There are 3 different types of ListBox:
    a. SpreadSheet 'Active X' ListBox (can get contents using Formula or VBA code)
    b. SpreadSheet Forms ListBox (can get contents using Formula or VBA code)
    c. UserForm ListBox (can get contents using VBA code only)

    In all 3 cases, the ListBox choices are linked to the cells A1 thru A26.
    The Forms ListBox selection is linked to cell 'F5' (returned as an index number). The Forms ListBox is assigned to Macro FormsListBoxEventHandler() which gets activated each time the Forms ListBox changes value.

    The 'Active X' ListBox selection is linked to cell 'F17'. The 'Active X 'ListBox is assigned to Macro ListBox1_Change() in the 'Sheet'1 code module which gets activated each time the Forms ListBox changes value.

    Please NOTE that 'Active X' controls do not play well with others, and can cause problems and worksheet corruption especially if hiding rows/columns and/or moving the workbook to a computer that uses a different version of Excel.


    You did not specify which you are using, so the attached file has examples for all 3 using both formulas and code as appropriate:

    'Active X' code in the Sheet1 Code Module:
    Please Login or Register  to view this content.
    Forms ListBox Code in Ordinary Code Module Module1:
    Please Login or Register  to view this content.

    UserForm Activation code in Ordinary Code Module Module1:
    Please Login or Register  to view this content.
    UserForm1 Code Module Code:
    Please Login or Register  to view this content.
    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. Replies: 1
    Last Post: 05-30-2015, 12:15 PM
  2. [SOLVED] UserForm Multiple Selection Listbox and Insert Row process Help 2013
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2014, 04:04 PM
  3. deleting cell based off selection in listbox VBA
    By happyexcelperson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-27-2013, 09:46 AM
  4. listbox selection based on underlying cell value
    By chrisjames25 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-26-2013, 03:04 PM
  5. [SOLVED] Multicolumn Listbox selection transfer to cell
    By audiotunesx in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-14-2012, 08:16 PM
  6. Multi select Listbox Items selection based on other Listbox item selection.
    By srinivassathi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2011, 05:53 AM
  7. [SOLVED] Listbox Cell Selection
    By Brian C in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2006, 03:00 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