Excel Scripts

Excel Scripts

‘compare two mailid ‘s and mark duplicate coulmn as  red  in colour

Dim  objexcel , objworkbook , objworksheet , i , j , Rows_Count

Set objexcel=createobject (“Excel.Application”)
Set objworkbook =objexcel.workbooks.open( “C:Documents and SettingsgcrDesktopgcreddy.xls”)
Set objworksheet=objworkbook.worksheets(1)

Rows_Count = objWorkSheet.UsedRange.Rows.Count
For i= 1to Rows_Count Step 1
Expected = objworksheet.Cells(i, 1)

For j = 1 to Rows_Count Step 1
Actual = objWorkSheet.Cells(j, 2)

If  StrComp(Expected, Actual,1) =0 Then
objworksheet.Cells(i, 1).interior.colorindex=3
Exit For
end if
Next
Next
objworkbook.Save
objExcel.Quit

Set objworksheet = Nothing
Set objworkbook = Nothing
Set objexcel = Nothing

 

 

Comments