VB script to compare two excel sheets
16 Jul 2008 - 12:18:59 pm

ExcelFilePath1 = InputBox("Please Enter the Path of first Excel File")
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FileExists(ExcelFilePath1) = false )Then
   msgbox  ExcelFilePath1 & " doesn't exist."

   wscript.quit
   End If

ExcelFilePath2 = InputBox("Please Enter the Path of second Excel File") 
If (fso.FileExists(ExcelFilePath2) = false )Then
   msgbox  ExcelFilePath2 & " doesn't exist."
   wscript.quit
End If




Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = false




Set objWorkbook1 = objExcel.Workbooks.Open(ExcelFilePath1)

Set objWorkbook2 = objExcel.Workbooks.Open(ExcelFilePath2)



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 green color if any changes in cells (for the first file)

           cell.Interior.ColorIndex = 4

'Highlights the same cell in the Second file

objWorksheet2.range(cell.Address).interior.colorIndex = 4

                          

       Else

           cell.Interior.ColorIndex = 0

       End If

   Next


ObjExcel.displayAlerts = False 



objExcel.Save

objExcel.quit



set objExcel=nothing


msgbox "It is Done"

Admin · 1038 views · 48 comments
Categories: VB Script, Excel Objects

Permanent link to full entry

http://automation-qtp.discussionsblog.com/QTP-b1/VB-script-to-compare-two-excel-sheets-b1-p9.htm

Comments

No comments are allowed in this blog


Leave a comment

No comments are allowed in this blog

Last Comment

However fake tag heuer ...

2010-05-10 @ 10:49:18 pm
by j watches


we hope we can help you ...

2010-05-10 @ 10:46:55 pm
by must de cartier replicas


discount miu miu shoes [url=http://www.new-fashion.org/dior-bags-c-161_132.html]christian dior designer ...

2010-05-10 @ 07:27:59 am
by louis vuitton


discount miu miu shoes [url=http://www.new-fashion.org/dior-bags-c-161_132.html]christian dior designer ...

2010-05-10 @ 07:27:21 am
by louis vuitton


discount miu miu shoes [url=http://www.new-fashion.org/dior-bags-c-161_132.html]christian dior designer ...

2010-05-10 @ 07:26:45 am
by louis vuitton


discount miu miu shoes [url=http://www.new-fashion.org/dior-bags-c-161_132.html]christian dior designer ...

2010-05-10 @ 07:26:11 am
by louis vuitton


fake rolex

2010-05-09 @ 12:26:18 am
by titoni box


We are the best online dealer ...

2010-05-09 @ 12:25:11 am
by how to spot


replica watch

2010-05-09 @ 12:23:51 am
by replica


watches replica ...

2010-05-09 @ 12:23:15 am
by omega speedmaster


An extremely common question is someone ...

2010-05-06 @ 05:58:42 pm
by v limited edition


omega master planet ocean ...

2010-05-06 @ 05:57:34 pm
by speedmaster


We are the best online dealer ...

2010-05-06 @ 05:55:49 pm
by colt watches


Save money up to 70% from ...

2010-05-06 @ 05:54:09 pm
by watches


rolex fake ...

2010-05-06 @ 05:53:39 pm
by replika tag heuer


Who's Online?

Member: 0
Visitor: 1

Announce

Tags

No tags in this Blog

rss Syndication

Archives