mattwellings
New Member
- Joined
- Jun 27, 2011
- Messages
- 2
Hi Guys, I have got a problem.
I am trying to compare two different excel workbooks by using a vbs script, the current script below is okay as it compares them.
But the issue is when a row has been shifted down, the script thinks that the data has changed and therefore highlights the row as red, but the data has only been moved down.
I have downloaded a programe called "Excel Compare" but as it is for a buisness i will need to buy a licese. What "Excel Compare" does is tell's you what data has been added and what data has been removed.
Any help would be greatly appreciated.
Thanks
I am trying to compare two different excel workbooks by using a vbs script, the current script below is okay as it compares them.
But the issue is when a row has been shifted down, the script thinks that the data has changed and therefore highlights the row as red, but the data has only been moved down.
I have downloaded a programe called "Excel Compare" but as it is for a buisness i will need to buy a licese. What "Excel Compare" does is tell's you what data has been added and what data has been removed.
Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook1= objExcel.Workbooks.Open("C:\Users\")
Set objWorkbook2= objExcel.Workbooks.Open("C:\Users\")
msgbox"The comparison started!",64, "Excel Comparison"
Set objWorksheet1= objWorkbook1.Worksheets(1)
Set objWorksheet2= objWorkbook2.Worksheets(1)
For Each cell In objWorksheet2.UsedRange
If cell.value <> objWorksheet1.Range(cell.Address).Value Then
cell.Interior.ColorIndex = 3
Else
cell.Interior.ColorIndex = 0
End If
Next
msgbox"The comparison has now complete!",64,"Excel Comparison"
set objExcel=nothing
Any help would be greatly appreciated.
Thanks