lozan
June 7th, 2008, 01:58 AM
Hi. I've been trying to remove duplicates in Excel worksheet.
So far, i've been trying to get something out of:
Microsoft.Office.Interop.Excel.Range.RemoveDuplicates(object Columns, Microsoft.Office.Interop.Excel.XlYesNoGuess Header)
which doesn't seem to have any explanation in MSDN nor anywhere i looked for. Well, it's pretty self-explanatory really, except the 1st parameter. I tried passing it an int array and casting it to object, but i am getting an exception. I can pass an int, like (object)1 for example, but then it takes in account just the 1st column and will remove all duplicates according to that.
So for example, if i input this table:
12 123 456
ds fds
12 123 456
12 123 456
54 123 33
54 47 33
this is what i am getting:
12 123 456
ds fds
54 123 33
And that's not i want to get. My last row should have stayed as well.
That would be like an equivalent to the Excel function when we press "Remove duplicates" and have an option to select which columns should be taken into account.
Thanks
So far, i've been trying to get something out of:
Microsoft.Office.Interop.Excel.Range.RemoveDuplicates(object Columns, Microsoft.Office.Interop.Excel.XlYesNoGuess Header)
which doesn't seem to have any explanation in MSDN nor anywhere i looked for. Well, it's pretty self-explanatory really, except the 1st parameter. I tried passing it an int array and casting it to object, but i am getting an exception. I can pass an int, like (object)1 for example, but then it takes in account just the 1st column and will remove all duplicates according to that.
So for example, if i input this table:
12 123 456
ds fds
12 123 456
12 123 456
54 123 33
54 47 33
this is what i am getting:
12 123 456
ds fds
54 123 33
And that's not i want to get. My last row should have stayed as well.
That would be like an equivalent to the Excel function when we press "Remove duplicates" and have an option to select which columns should be taken into account.
Thanks