+ Reply to Thread
Results 1 to 5 of 5

If number in column duplicated on sheet change then problen

  1. #1
    Registered User
    Join Date
    10-24-2011
    Location
    SA, Australia
    MS-Off Ver
    Excel 2010
    Posts
    15

    If number in column duplicated on sheet change then problen

    Hi
    I have a worksheet "Orders". A macro adds a new row and increments an "OrderNO" by 1. This works fine

    I have to allow the user to re-use a previous number but want to warn them it is a duplicate. I have tried using a sheet change action. If the user overtypes the automatically created number it checks for duplicates and if found a message box appears advising number already used retry or cancel.

    It works fine. If retry cell is emptied and selected. If cancel then repeat number stays.

    Problem is as I move to the next column it repeats the check and I get the message again. It does this for all cells in that row.

    I only want it to check if A4 is reeapted in A5:A10000.

    How do I stop it working from all cell changes?

    Here's my code (I hope I have posted it correctly). Any help much appreciated

    Please Login or Register  to view this content.

    The old fogey

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: If number in column duplicated on sheet change then problen

    May be this,,,?

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    10-24-2011
    Location
    SA, Australia
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: If number in column duplicated on sheet change then problen

    Thanks SixthSense. That works in that it sets the cell to empty however I need to allow them to re-use a number 2 or more times if they want to. I was trying to do it by using vbretry / cancel. If cancel then allow the number to stay as a duplicate.

    My code did that but when I went into another cell eg D4 and typed soemthing in then left the cell the check on A5:A1000 fires off again. It does it for every cell I change in that row.

    I need to stop the check once the focus leaves A4

    Cheers
    the old fogey

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: If number in column duplicated on sheet change then problen

    Quote Originally Posted by djon5020 View Post
    My code did that but when I went into another cell eg D4 and typed soemthing in then left the cell the check on A5:A1000 fires off again. It does it for every cell I change in that row.
    My suggested method of code will exit soon when the entry don't happen in Range("a4:a10000")

  5. #5
    Registered User
    Join Date
    10-24-2011
    Location
    SA, Australia
    MS-Off Ver
    Excel 2010
    Posts
    15

    Thumbs up Re: If number in column duplicated on sheet change then problen

    HI Sixth sense

    I think I have it solved.

    In my worksheet change event I set the target to just A4

    Please Login or Register  to view this content.
    Then I created a new macro witht he check for repeat code
    Now it doesnt fire off when in a different cell.

    Heres my macro code to do the check and allow repeat if cancel is selected

    Please Login or Register  to view this content.
    The old fogey

+ 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] Automatically change sheet number when first sheet is filled in.
    By Bikeman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-29-2014, 04:36 PM
  2. [SOLVED] Conditional Format - Highlight a Cell in Sheet 2 if Duplicated from Sheet 1
    By sliesneekr in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2014, 09:16 AM
  3. [SOLVED] Change all matching Value based on number change in Column Excel 2007
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 02-20-2014, 11:40 AM
  4. Match Column A's Project number to change based on greater number in new row
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2013, 10:18 AM
  5. Vlookup but change column index number as you drag to next column
    By yankeekid86 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-29-2013, 09:46 AM

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