SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Dec 2006
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Excel Comparision Code required?

    Hi,

    Please,if anyone provide me the code for comparing two Excel files.

    it must compare each cell and if they are not matching its highlights in RED/GREEN colors

    Thanks
    Vasu

  2. #2
    Junior Member
    Join Date
    Nov 2007
    Location
    Brazil
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Excel Comparision Code required?

    I haven't used this code for a long time, but it should work...

    Leonardo R.O.

    <font class="small">Code:</font><hr /><pre>
    'compare two different excel files (source-A with destination-B) and store
    'the difference information in another excel file called Results-C.

    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    Set objWorkbook1= objExcel.Workbooks.Open("C:\sheet1.xls")
    Set objWorkbook2= objExcel.Workbooks.Open("C:\sheet2.xls")
    set newWorkbook=objExcel.Workbooks.Add
    Set objWorksheet1= objWorkbook1.Worksheets(1)

    Set objWorksheet2= objWorkbook2.Worksheets(1)
    Set objNewWorksheet= newWorkbook.Worksheets(1)

    For Each cell In objWorksheet1.UsedRange
    If cell.Value &lt;&gt; objWorksheet2.Range(cell.Address).Value Then
    objNewWorksheet.Range(cell.Address).Value=cell.Val ue
    objNewWorksheet.Range(cell.Address).Interior.Color Index = 3 'Highlights in red color if any changes in cells
    End If
    Next
    </pre><hr />
    Regards,
    Leonardo Ribeiro Oliveira

  3. #3
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Excel Comparision Code required?

    did you search the forum before asking this question?

 

 

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 Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:44 AM.

Copyright BetaSoft Inc.