+ Reply to Thread
Results 1 to 11 of 11

Delete button to remove cell value from Listbox

  1. #1
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Delete button to remove cell value from Listbox

    Hi,

    I have a list box that shows a range of cells (called emailrange). I want to add a Delete button that enables a selected value in the Listbox to be deleted if necessary (just the cell value not the row).

    The code I have thus far is below:

    Please Login or Register  to view this content.
    Any help would be appreciated.

    Thank you
    Last edited by jpruffle; 04-16-2009 at 07:16 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Delete button to remove cell value from Listbox

    Do you mean deleted from the sheet?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Re: Delete button to remove cell value from Listbox

    Yes,

    The list is copied from a second sheet called ConKins and all email addresses that are copied are contained within cells B2:B100 within that sheet. The Listbox on Sheet1 (Email) pulls the pasted data and places it in cells A2 down. I want to be able to delete from the range on the Email sheet from range A2 etc. So the original list contained on ConKins stays intact.

    Than you once again!

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Delete button to remove cell value from Listbox

    Try this
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Re: Delete button to remove cell value from Listbox

    HI,

    I have added that code on the line:

    .RemoveItem Rw

    I get an error stating Run Time Error, Unspecified error. I have Excel 2000 is it something to do with that?

    Does that code remove a cell rather than a row?

    Thanks

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Delete button to remove cell value from Listbox

    The code deletes a cell's contents.
    You need to attach the workbook.

  7. #7
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Re: Delete button to remove cell value from Listbox

    Attached an example of the error.

    Thank you again.
    Attached Files Attached Files

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Delete button to remove cell value from Listbox

    There's no data to test with

  9. #9
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Re: Delete button to remove cell value from Listbox

    Apologies attached the wrong file!
    Attached Files Attached Files

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Delete button to remove cell value from Listbox

    First delete all the existing code in UserForm1, then replace with this
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Re: Delete button to remove cell value from Listbox

    Thank you,

    The line: .RemoveItem (Rw) came up with an error so I took it out of the code and it worked fine.

    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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