+ Reply to Thread
Results 1 to 8 of 8

Finding multiple entries

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Finding multiple entries

    Hi,

    I am developing an inventory application wherein the users have to enter the items issued. Each entry can have upto 30 items being issued.

    Due to the pecularities of our system, I cannot allow the user to enter the same item multiple times. Say Item "Orange" has been entered in row 1. Then I cannot have the user entering "Orange" again in the remaining rows 2 to 30.

    For your information the check can be based on the item code which in column A. Also I do not need the check to take place on-line (that is as soon as an item code is duplicated - although this would greatly enhance the utility), but can also be done when the "Save" is selected.

    Currently I am using the countif function hidden in another column to do this, but I find that this is not a very elegant method.

    Any help will be greatly appreciated.

    Anand
    Last edited by anandvh; 01-27-2012 at 03:25 PM.

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Finding multiple entries

    Put this in the sheets code module, whenever a user inputs something in a cell that appears elsewhere in same row, the user will be promted to type in a different value.

    Please Login or Register  to view this content.
    Please take time to read the forum rules

  3. #3
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Finding multiple entries

    I would use a worksheet_change event - place this code into the sheet where values are entered - I am assuming the values are going into Column A
    Please Login or Register  to view this content.
    Anthony
    “Confidence never comes from having all the answers; it comes from being open to all the questions.”
    PS: Remember to mark your questions as Solved once you are satisfied and rate the answer(s) questions.”

  4. #4
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Re: Finding multiple entries

    Thanks Steffen Thomsen and smuzoen for your prompt responses. Steffen, your code worked well. The only issue I faced was that the cursor appears in the same position. If this can be moved up one row, then the solution would work really well. I added
    Please Login or Register  to view this content.
    after the
    Please Login or Register  to view this content.
    line. Got the code to work just the way I wanted

    Sumzoen : Also tried out your code. Had a couple of issues. The error message does not go away once the second instance has been deleted. Pressing enter again deletes the first instance.

    Thanks to both of you, my application is now getting slicker thanks to all your contributions. Appreciate your contributions.

    Anand
    Last edited by anandvh; 01-27-2012 at 03:23 PM.

  5. #5
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Re: Finding multiple entries

    I was trying out the code. Worked fine when the working with individual cells. But if I use this on merged cells, the statement
    Please Login or Register  to view this content.
    does not work. I get an error that merged cells cannot be deleted. Any solution to this ?

  6. #6
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Finding multiple entries

    Yes, dont use merged cells

    merged cells tend to mess up code.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Finding multiple entries

    I'd prefer to give the user a list of valid items to choose from (you can use validationlist to do so).
    It's not a nice thing to suggest the user did something 'wrong'.
    Besides input will slow down drastically when errror messages are being displayed.
    You should prevent that whenever possible.
    Last edited by snb; 01-28-2012 at 12:26 PM.



  8. #8
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Re: Finding multiple entries

    Thanks Steffen - I am redoing the layout of the worksheet without merging cells.

    snb - thanks for the input. My first choice was to provide a validation list. However two issues prevented this. First, the inventory codes with the descriptions are stored in another worksheet used for masters. Second, a validation list would only provide the item codes which confuses the user if the descriptions are not displayed alongside. I could not find a solution wherein I display the code and description in a drop down box and then pick out only the code into the cell.

    Any suggestions would be greatly appreciated.

+ 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