|
-
June 7th, 2008, 01:58 AM
#1
Remove Duplicates in Excel
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
-
June 7th, 2008, 02:34 AM
#2
Re: Remove Duplicates in Excel
I solved it. I just passed an int array casted to object.
-
June 10th, 2010, 08:43 AM
#3
Re: Remove Duplicates in Excel
can you explain how do you make the conection an remove the duplicates in more details pls
-
June 10th, 2010, 08:50 AM
#4
Re: Remove Duplicates in Excel
This thread i two years old! Please make a new thread if you need help.
To answer the question: You can modify an Excel workbook using C# in a few ways, such as through COM Interop or an OLEDB Adapter.
It's not a bug, it's a feature!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|