+ Reply to Thread
Results 1 to 12 of 12

VBA code to find duplicate Document No.

  1. #1
    Registered User
    Join Date
    11-07-2014
    Location
    India
    MS-Off Ver
    2016
    Posts
    88

    VBA code to find duplicate Document No.

    Hi,

    I am looking for a VBA code to find duplicate document numbers but having different voucher no. Please refer to attached file for more information.

    Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: VBA code to find duplicate Document No.

    You may try following code:
    Please Login or Register  to view this content.
    Of course this is just a test and show approach. But it can be used as a backbone to for instance write comments next to each duplicate, list them in a separate table, store all in a string variable and show only one comment at the end of processing, etc.
    Attached Files Attached Files
    Last edited by Kaper; 03-13-2020 at 04:20 AM.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    11-07-2014
    Location
    India
    MS-Off Ver
    2016
    Posts
    88

    Re: VBA code to find duplicate Document No.

    Exactly. But, can you help me to built a public function like =duplicate() to find this duplicates. Sorry, but I am a beginner and do not know how to built public function

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: VBA code to find duplicate Document No.

    Try:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-07-2014
    Location
    India
    MS-Off Ver
    2016
    Posts
    88

    Re: VBA code to find duplicate Document No.

    Sorry, but how to use this? What i have to type?

  6. #6
    Registered User
    Join Date
    11-07-2014
    Location
    India
    MS-Off Ver
    2016
    Posts
    88

    Re: VBA code to find duplicate Document No.

    Anyone please help me. I am looking for public function (so that I can use in Column 'C') to find duplicates Or else, please suggest a macro to get 'Duplicates' in column 'C'.

    I don't want a message box saying it. Instead I want the same thing in the column 'C' against said line item.

    Please help me in change the above public function or VBA code.

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: VBA code to find duplicate Document No.

    For such application there is really no need to use VBA at all.
    Standard function would do it perfectly well.
    Try in C2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy the C2 cell down. The easiest way is by selecting C2 and double click on filling handle (a small black square in lower-right corner of selection frame)
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-07-2014
    Location
    India
    MS-Off Ver
    2016
    Posts
    88

    Re: VBA code to find duplicate Document No.

    Quote Originally Posted by Kaper View Post
    For such application there is really no need to use VBA at all.
    Standard function would do it perfectly well.
    Try in C2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy the C2 cell down. The easiest way is by selecting C2 and double click on filling handle (a small black square in lower-right corner of selection frame)
    You are genius. Thanks for the formula.

  9. #9
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: VBA code to find duplicate Document No.

    As that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, as a not-so-frequent visitor of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  10. #10
    Registered User
    Join Date
    11-07-2014
    Location
    India
    MS-Off Ver
    2016
    Posts
    88
    Quote Originally Posted by Kaustubh1040 View Post
    You are genius. Thanks for the formula.
    The formula is working fine..but i m having 15000 rows and thereby it is taking too much time..
    Can you help me to find duplicate document number from 15000 rows in column C

  11. #11
    Registered User
    Join Date
    11-07-2014
    Location
    India
    MS-Off Ver
    2016
    Posts
    88

    Re: VBA code to find duplicate Document No.

    Please help.. How to use this countifs function faster on 15000 rows

  12. #12
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: VBA code to find duplicate Document No.

    Having no more clues (like: are rows sorted by document number + how many documents of one type could be present in dataset) I would say:

    Copy the formula down. Let the spreadsheet calculate once (press F9 to force it if needed).
    Select all but first cells with formula (now displaying results) copy it and paste special in the same range as values only.

+ 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. vba code to find and replace text in word document from excel
    By sankpati in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 10-23-2019, 07:26 AM
  2. How do you find and tag/code duplicate cells?
    By ZDan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-01-2019, 11:03 AM
  3. [SOLVED] VB Code to find and delete duplicate rows
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-20-2018, 06:43 PM
  4. VB Code to find duplicate and delete row
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2015, 05:35 PM
  5. VBA Code to find duplicate in worksheet
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-02-2015, 06:33 PM
  6. [SOLVED] VBA code to find duplicate and combine their values
    By tohor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2013, 03:45 AM
  7. [SOLVED] Code to find duplicate colors and keep only 1 entry
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-16-2013, 12:57 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