+ Reply to Thread
Results 1 to 11 of 11

Match header information

  1. #1
    Registered User
    Join Date
    12-02-2012
    Location
    India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    13

    Match header information

    Hi All,

    I have 2 workbooks having header information in both the workbooks, now i want to compare both header information across 2 workbooks.....the main thing here is I need to check both the header information are matching or not in 2 workbooks.

    I think it is better to have macro 2 check the header information from both the workbooks. Please help me. Thank you in Advance.

    Regards,
    Venkatesh.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Match header information

    Hi Venkatesh,

    Welcome to the forum. Try the below code:

    Please Login or Register  to view this content.
    Does that work for you?
    If solved kindly remember to mark Thread as solved.
    Click the small star icon at the bottom left of my post if this was useful.

  3. #3
    Registered User
    Join Date
    12-02-2012
    Location
    India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    13

    Re: Match header information

    hi kumar,

    Thank you for your reply, but i have a problem while running the macro.

    I have added your code into my excel vba under 'this workbook' and I have saved this with macro enabled. And after that I have opened my attachments workbook1 and workbook2 and also my workbook macro. I have run the macro but I am seeing '400' error. please help me where is the problem.

    Regards,
    Venkatesh.

  4. #4
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Match header information

    Use the code in either "Sheet1" or "This workbook" setion of workbook1.xlsx.

    Then open the workbook2.xlsx and run the macro from workbook1.xlsx....hope that works

    Am at work so wont be able to upload the file I had worked upon until later today.

  5. #5
    Registered User
    Join Date
    12-02-2012
    Location
    India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    13

    Re: Match header information

    thanks kumar it's working perfectly.

    Please let me know how to learn macros and if possible please provide me the material link or any documents, so that I can learn it.

    Regards,
    Venkatesh.

  6. #6
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Match header information

    Glad it worked Venkatesh. If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Re links to VBA materials, see below:

    http://www.excel-vba.com/excel-vba-contents.htm

    http://www.excelforum.com/excel-prog...materials.html

    Hope you find them useful...

  7. #7
    Registered User
    Join Date
    12-02-2012
    Location
    India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    13

    Re: Match header information

    hi kumar, I have a problem with running the macro, even though the header information is same in both the excel files. I am getting the error has 'Run-time error '9':Subscript out of range'.Please look into this once and find the attached excel files. thanks.

    Regards,
    Venkatesh.
    Attached Files Attached Files
    Last edited by Venkatesh s; 12-10-2012 at 03:37 PM.

  8. #8
    Registered User
    Join Date
    12-02-2012
    Location
    India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    13

    Re: Match header information

    Hi All,

    Can anyone please look into the above question know. Thanks.

    Regards,
    Venkatesh.

  9. #9
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Match header information

    Hi Venkatesh,

    You need to change the workbook name in the code when you try this in other workbooks. See the highlighted line in the code below:

    Please Login or Register  to view this content.
    Hope this helps...

  10. #10
    Registered User
    Join Date
    12-02-2012
    Location
    India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    13

    Re: Match header information

    hi kumar, thanks it's working now, I have one more question, for the above code always we need to change the current file name to run this header macro, instead of giving file name is there any possibility to run macro without giving file name.

    like for example if I open two excel files it should automatically match the header information in both the excel file by running the macro instead of always changing the file name.

    Please let me know if there any possibility to do so. Thanks once again for looking into this.

    Regards,
    Venkatesh.

  11. #11
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Match header information

    Though complex, I think that could be achieved by creating an Add-In in Excel so that you can have the options to select 2 workbooks and ask the macro to compare the headings in both of them instead of making the file names constant...

+ 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