+ Reply to Thread
Results 1 to 6 of 6

VBA Not deleting the correct row/ duplicate names

  1. #1
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    VBA Not deleting the correct row/ duplicate names

    Hi,

    I've been using the following code to delete the row of a person who's name is selected from a combo box. It has been working great until recently where names can be duplicated in the list. As a result, When I select a name it is deleting someone else's row. Any suggestions as to how to fix this?

    Please Login or Register  to view this content.
    The second part of the code calls on a function I have to display a list of unique names without duplicates in the combo box.

    Thanks!

    M

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: VBA Not deleting the correct row/ duplicate names

    Hello SUTTEHFACE,

    Can you post your workbook?

    Posting your workbook will get you answers more quickly and all solutions can be tested directly.

    Please provide before and after examples of your data along with any notes you would like to include.

    If your workbook contains any sensitive information, please redact that information before you post your workbook.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: VBA Not deleting the correct row/ duplicate names

    Schedule EX.xlsm

    Sorry for the late reply,

    Attached is a copy of my workbook. As you will see, when I try to delete someone, it deletes the wrong person. I commented out some of the VBA code I was working on recently, the one still in use is what I was using before I started having duplicates in column A.

    Thanks,

    M

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Not deleting the correct row/ duplicate names

    Hi SUTTRHFACE

    Replace your Command Button 2 Code with this
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: VBA Not deleting the correct row/ duplicate names

    This seems to work great! Thank you for your help

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Not deleting the correct row/ duplicate names

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. graph axis names not correct,
    By deltasig in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 04-02-2014, 08:55 AM
  2. Replies: 11
    Last Post: 10-21-2012, 01:40 AM
  3. Sort names (first,last) into correct columns
    By treva26 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2007, 03:22 AM
  4. deleting duplicate names
    By torbau in forum Excel General
    Replies: 0
    Last Post: 03-08-2006, 01:10 PM
  5. [SOLVED] deleting duplicate names
    By chris in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-16-2006, 04:50 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