How to compare two excel sheets?Need any sample Scrpt....

Showing Answers 1 - 4 of 4 Answers

Barnabas

  • Jan 22nd, 2007
 

Hi,

We have option for comparing the Excel Sheets. For generataing macros we compared.

And another one option is, using if condition we compare the two cells, and apply for the whole.

Thanks

Barna

  Was this answer useful?  Yes

silambarasi

  • Jul 29th, 2011
 

Compare 2 Excel sheets cell by cell

Code
  1. Set objExcel = CreateObject(Excel.Application)

  2. objExcel.Visible = True

  3. Set objWorkbook1= objExcel.Workbooks.Open(sample1.xls)

  4. Set objWorkbook2= objExcel.Workbooks.Open(sapmle2.xls)

  5. Set objWorksheet1= objWorkbook1.Worksheets(1)

  6. Set objWorksheet2= objWorkbook2.Worksheets(1)

  7. For Each cell In objWorksheet1.UsedRange

  8.   If cell.Value <> objWorksheet2.Range(cell.Address).Value Then  

  9.      cell.Interior.ColorIndex = 3

  10.      'Highlights in red color if any changes in cells

  11.   Else

  12.      cell.Interior.ColorIndex = 0

  13.   End If

  14. Next

  15.  

  16. set objExcel=nothing

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions