+ Reply to Thread
Results 1 to 5 of 5

VBA compare worksheets - Adjustment

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    Switzerland
    MS-Off Ver
    MS Excel 365
    Posts
    68

    VBA compare worksheets - Adjustment

    Hi!

    I found the below code in this forum to compare the content of two worksheets within the same workbook. In fact, the code is working pretty good. However, when the code does not find any differences, I have an "out of range". Any idea, how to fix this with a pop-up "Nothing found"? Thanks in advance!

    Please Login or Register  to view this content.
    Last edited by FixandFoxi; 06-18-2012 at 09:47 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA compare worksheets - Adjustment

    Can you attach the sample file that you are using with the code?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    06-06-2012
    Location
    Switzerland
    MS-Off Ver
    MS Excel 365
    Posts
    68

    Re: VBA compare worksheets - Adjustment

    Hi & thanks for your reply! Please find attached the file. The workbook has two sheets. As you will note, there is a difference in cell B6 (the age is missing in the second sheet). When you now perform the macro, the code will drop you this difference. However, as soon as the sheets are equal (e.g. add 96 in the second sheet), I have the "out of range".
    Attached Files Attached Files

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA compare worksheets - Adjustment

    Your code is giving at error on this line
    Please Login or Register  to view this content.
    But i dont have much experience with arrays. Let us see if you get some help from others here or i can push it to the experts.

  5. #5
    Registered User
    Join Date
    06-06-2012
    Location
    Switzerland
    MS-Off Ver
    MS Excel 365
    Posts
    68

    Re: VBA compare worksheets - Adjustment

    After Line47 I added:

    Please Login or Register  to view this content.
    The code is now working when NO/NIL differences are found.

+ 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