+ Reply to Thread
Results 1 to 7 of 7

Matching columns of 2 Workbooks and copying the match values to a worksheet.

  1. #1
    Registered User
    Join Date
    02-09-2012
    Location
    Manassas, Virginia, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Matching columns of 2 Workbooks and copying the match values to a worksheet.

    There r 2 workbooks 'ACP.xlsm' and 'Reference.xlsm'. The code must compare a value (fm 3rd row) in col A of ACP.xlsm workbook to a value (rows frm A2 of) in column A of Reference.xlsm work book or column B, C in tat order. If a match is found thn it should offset one step from col A in ACP.xlsm to col B in ACP.xlsm and check for a value "WS Grouup Totals:" in that col & when it finds the 1st instance of the value, it should stop checking and copy the range of rows from the row when Col A in ACP.xlsm matched with a value in Col (A or B or C ) in Reference .xlsm and paste it in separate worksheet in ACP.xlsm. I have written a code for the purpose but when I run this code it keeps on throwing me the error that subscript is out of range (Error9).can you please help me run this code or suggest a better code...I am a beginner and I am at my wits end.thank you.I have attached my data files for your reference in case my description is not clear...my full code can be found in ACP.xlsm file attached...can't post it here cos of the line limit...please help thanks..
    Attached Files Attached Files
    Last edited by shrimic; 02-09-2012 at 10:10 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Have some problem running the below code...please help...thanks in advance

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    02-09-2012
    Location
    Manassas, Virginia, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Have some problem running the below code...please help...thanks in advance

    Thanks Richard, Sorry this is my first time in the forum and I was not aware of the rules...I have made the change as advised by you...

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Have some problem running the below code...please help...thanks in advance

    Hi

    First thing I found is that your code is looking for sheets in acp.xlsm that don't exist. In the example file you have sheet1, sheet2 and sheet3, but your code goes looking for Sheet4, Sheet5, Sheet6....

    rylo
    Last edited by rylo; 02-09-2012 at 08:43 PM.

  5. #5
    Registered User
    Join Date
    02-09-2012
    Location
    Manassas, Virginia, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Have some problem running the below code...please help...thanks in advance

    Thanks rylo,
    Please find my full code in the ACP.xlsm file attached..couldn't post here cos of the line limit

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Matching columns of 2 Workbooks and copying the match values to a worksheet.

    Hi

    You now have 2 copies of ACP.xlsm in post #1 and they both have code that refers to sheets that don't exist in that file.

    rylo

  7. #7
    Registered User
    Join Date
    02-09-2012
    Location
    Manassas, Virginia, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Matching columns of 2 Workbooks and copying the match values to a worksheet.

    ok now I get it..I need to first add those sheets before I can copy to them..thanks..

+ 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