+ Reply to Thread
Results 1 to 9 of 9

user box options if cell entry is a duplicate found in a table column

  1. #1
    Forum Contributor
    Join Date
    10-01-2008
    Location
    Eureka, CA
    Posts
    161

    user box options if cell entry is a duplicate found in a table column

    Hi, I have a table that i use for a customer database. and the end user adds new customers to this table, what i would like is for a message box to pop up whenever cell B2 matches an entry in a column in the customers table. the table starts on row 25, and the column i would like to check for duplicates is column B. I would like the message box to give the user the message "A customer by this name already exists, Would you like to load this customers file?" If the answer is yes, then the row that the match was found on would be copied and pasted onto row 1. if the answer is no, then nothing else happens. I hope this makes sense, i am posting this sheet of my workbook for reference. hope it makes sense. Thanks for any help guys, the help i have gotten on this forum already is just incredible, thanks again.

    excel help forum.xlsx
    Last edited by humboldtguy; 08-24-2009 at 02:25 PM. Reason: problem solved

  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: user box options if cell entry is a duplicate found in a table column

    Hello humboldtguy,

    Here is macro that will search worksheet "Sheet1" starting at cell "B25" down to the last entry in column "B" for the contents of cell "B2". If the customer exists, a message box will prompt the user. Copy this macro into a standard VBA module.
    Please Login or Register  to view this content.
    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
    10-01-2008
    Location
    Eureka, CA
    Posts
    161

    Re: user box options if cell entry is a duplicate found in a table column

    Hey Leith thanks for the quick response. That works exactly like i want, however i need for this macro to run automatically as soon as a match occurs...can that be done?

  4. #4
    Forum Contributor trucker10's Avatar
    Join Date
    07-22-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 / 2007 / 2010 prof +
    Posts
    149

    Re: user box options if cell entry is a duplicate found in a table column

    Quote Originally Posted by humboldtguy View Post
    Hey Leith thanks for the quick response. That works exactly like i want, however i need for this macro to run automatically as soon as a match occurs...can that be done?
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-01-2008
    Location
    Eureka, CA
    Posts
    161

    Re: user box options if cell entry is a duplicate found in a table column

    Trucker, thanks for the response...I dont have very much knowledge of VBA, just trying to learn....i'm not sure how to edit the code that you put up...i have been tinkering with it, trying to figure it out, but am not having any luck....can you tell me what i need to change?

  6. #6
    Forum Contributor trucker10's Avatar
    Join Date
    07-22-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003 / 2007 / 2010 prof +
    Posts
    149

    Re: user box options if cell entry is a duplicate found in a table column

    Replace the old code by this one , from the Belgium highway

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-01-2008
    Location
    Eureka, CA
    Posts
    161

    Re: user box options if cell entry is a duplicate found in a table column

    Hey Trucker, Thanks for the help, unfortunately it still isnt working for me. Not sure what I am doing wrong. Any idea's? Here is the code i ended up with....note that on my original workbook the sheet name is "Customers"

    Please Login or Register  to view this content.

  8. #8
    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: user box options if cell entry is a duplicate found in a table column

    Hello humboldtguy,

    If you want the macro to run whenever "B2" changes then you need to use the Worksheet_Change event. Leave the macro in the VBA module and call it from the "Customer" worksheet event like this...

    Customer Worksheet
    Please Login or Register  to view this content.
    Module Code
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    10-01-2008
    Location
    Eureka, CA
    Posts
    161

    Re: user box options if cell entry is a duplicate found in a table column

    Alright now that is perfect Leith....Thank you Leith and Trucker...you guys are awesome! I can't thank the people on this forum enough for all the help.

+ 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