Tuesday, August 5, 2008

Deleting the dupliacte data from Excel sheet

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Open("D:\Qtp_ framewrk_Keyworddriven\16June_Final_Test_Scenarios_phpcollab.xls")

nor = objExcel.sheets(3).usedrange.rows.count

for i = 1 to nor
cd = objExcel.sheets(3).Cells(i, 1)
j = i+1
do Until objExcel.Cells(j, 1).Value = ""
cd1 = objExcel.sheets(3).Cells(j, 1)
if Ucase(trim(cd)) = Ucase(trim(cd1)) then
Set objRange = objExcel.Cells(j, 1).EntireRow
objRange.Delete
j = j-1
End If
j = j + 1
Loop
Next


Regards,

PavanKumar Nandagiri...........

Google Search

Google