+ Reply to Thread
Results 1 to 5 of 5

Delete selected item from ListBox with KeyDown event

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    480

    Delete selected item from ListBox with KeyDown event

    Hi all,

    I have a UserForm with 3 Buttons and 1 ListBox, now I want the user to be able to delete items in the ListBox by selecting them and pressing the delete key. I searched online and found the KeyDown event that I suppose can be used to achieve that. However, I cannot get it to work. Below is what I've got so far:

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016
    Posts
    762

    Re: Delete selected item from ListBox with KeyDown event

    It would help us a lot if you add a non-personalised spreadsheet to your request. You can't expect us to rebuild your spreadsheet from scratch!
    B/R
    Erwin
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,683

    Re: Delete selected item from ListBox with KeyDown event

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    480

    Re: Delete selected item from ListBox with KeyDown event

    Argh, so close! Thanks bakerman2, works with ease!!

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,683

    Re: Delete selected item from ListBox with KeyDown event

    Argh, so close!
    But no sigar.

    Thanks for rep+.

+ 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] how to get the next item value based on the selected item in userform listbox ?
    By karmapala in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2019, 05:49 AM
  2. Filtered ListBox Selected item delete in sheet Entire Row
    By sijostephen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2019, 05:38 PM
  3. [SOLVED] Moving all columns from listbox 1 to listbox 2 and see all details of an selected item
    By alexgoaga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2018, 07:09 PM
  4. [SOLVED] Do something for each selected item in a listbox
    By stojko89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2017, 06:38 AM
  5. [SOLVED] VBA to remove item selected from ListBox and to find in row source and delete as well
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2016, 11:51 AM
  6. Selected item in first listbox.
    By waka in forum Access Tables & Databases
    Replies: 1
    Last Post: 02-09-2015, 11:45 PM
  7. Selecting a listbox item event
    By Todd Huttenstine in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-27-2005, 04:05 PM

Tags for this Thread

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