QTP Forum
Shopmotion


How to Compare two Excel sheets cell by cell Empty
Search
 
 

Display results as :
 


Rechercher Advanced Search

Poll
Keywords

Latest topics
September 2019
MonTueWedThuFriSatSun
      1
2345678
9101112131415
16171819202122
23242526272829
30      

Calendar Calendar

Affiliates
free forum


How to Compare two Excel sheets cell by cell

Go down

Vote if this topic was useful to you

How to Compare two Excel sheets cell by cell Vote_lcap0%How to Compare two Excel sheets cell by cell Vote_rcap 0% 
[ 0 ]
How to Compare two Excel sheets cell by cell Vote_lcap0%How to Compare two Excel sheets cell by cell Vote_rcap 0% 
[ 0 ]
How to Compare two Excel sheets cell by cell Vote_lcap100%How to Compare two Excel sheets cell by cell Vote_rcap 100% 
[ 1 ]
How to Compare two Excel sheets cell by cell Vote_lcap0%How to Compare two Excel sheets cell by cell Vote_rcap 0% 
[ 0 ]
 
Total Votes : 1

How to Compare two Excel sheets cell by cell Empty How to Compare two Excel sheets cell by cell

Post by Gajre on Wed Jul 04, 2012 3:19 am

''This code will open two excel sheet and compare each sheet cell by cell, if any changes there in cells , it will highlight the cells in red color in the first sheet.

Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible = True
Set objWorkbook1= objExcel.Workbooks.Open(“C:\Users\sgajre\Desktop\ListOfTopics1.xls”)
Set objWorkbook2= objExcel.Workbooks.Open(“C:\Users\sgajre\Desktop\ListOfTopics2.xls”)
Set objWorksheet1= objWorkbook1.Worksheets(1)
Set objWorksheet2= objWorkbook2.Worksheets(1)
For Each cell In objWorksheet1.UsedRange
If cell.Value <> objWorksheet2.Range(cell.Address).Value Then
'Highlights in red color if any changes in cells
cell.Interior.ColorIndex = 3
Else
cell.Interior.ColorIndex = 0
End If
Next
set objExcel=nothing
Gajre
Gajre
Admin

Posts : 37
Join date : 2012-06-17
Age : 36
Location : Hyderabad

View user profile https://qtpelearning.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum