11-12-2009, 10:45 AM
Hi,
If it is loop condition obviously u need to pass data using datatable to application
Suggestions:
1.Before sending the values to application first delete the duplicate data in datatable itself
2.Then pass the data which is without duplicates to the application
Here for second step u might not be having any issue directly u can pass the data to the application
For the first step i am giving u some advisable scenario's
Deleting a duplicate rows from excel sheet
_______________________________________________
Please let me know if u need any informatiuon aprt from this.
Thanks,
Venkat.Batchu
If it is loop condition obviously u need to pass data using datatable to application
Suggestions:
1.Before sending the values to application first delete the duplicate data in datatable itself
2.Then pass the data which is without duplicates to the application
Here for second step u might not be having any issue directly u can pass the data to the application
For the first step i am giving u some advisable scenario's
Deleting a duplicate rows from excel sheet
_______________________________________________
Code:
set aa=Createobject("Excel.Application")
set b=aa.Workbooks.open("D:\batchu.xls")
set c=aa.worksheets("sheet1")
c.Cells.Sort c.Range("A1"),1,,,,,,2,1,False,,,1
m=datatable.getrowcount
m=50 'number of rows avaialable in excel sheet
for j=1 to 10 step 1 'just to find the number of duplicates even if it is more than 2 duplicates in this case i considered up to 10 duplicate records
for i=1 to m step 1
d=c.cells(i,1).value
if c.cells(i,1).value=c.cells(i+1,1).value then
'msgbox m
'msgbox c.cells(i+1,1).value
c.Rows(i+1).delete
b.save
m=m-1
'msgbox m
end if
if i=m then
'msgbox i
'msgbox m
Exit for
end if
Next
Next
'msgbox d
b.close
Please let me know if u need any informatiuon aprt from this.
Thanks,
Venkat.Batchu