+ Reply to Thread
Results 1 to 3 of 3

VBA code explanation needed - Sometimes outputs wrong data

  1. #1
    Registered User
    Join Date
    11-26-2011
    Location
    Norway
    MS-Off Ver
    Excel 2007
    Posts
    11

    VBA code explanation needed - Sometimes outputs wrong data

    Hi all

    I have used the below code for a while, but it sometimes outputs values in a cell when its not supposed to.
    i got help creating this code in this forum a while ago

    Please Login or Register  to view this content.
    What this code does is mathing row A and B in sheet "ordre" with row A and B in sheets "kommentarbackup" and
    copies row C from "kommentarbackup" to row L "ordre" in column where both matches.

    I think that my problem is when i have a row A and B that doesnt match - i think in these cases the formula copies the corresponding row anyway - (example : now match row A and B "ordre" row 265 : copies row C "kommentarbackup" row 265 to row L "ordre" row 265. Not sure though

    ill paste the link to my original post for further explanation :
    http://www.excelforum.com/excel-prog...-in-range.html
    Last edited by Biinge; 03-03-2012 at 03:33 PM.

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VBA code explanation needed - Sometimes outputs wrong data

    Your code passes 0 to the INDEX function when a value is not matched, which is the equivalent of getting the whole column back. I would use something like
    Please Login or Register  to view this content.
    Good luck.

  3. #3
    Registered User
    Join Date
    11-26-2011
    Location
    Norway
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VBA code explanation needed - Sometimes outputs wrong data

    Thanks that code works perfect!

+ 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