I'm trying to remove duplicate values in an excel sheet through visual c#. I found the following function:
xlWorkSheet.Columns.RemoveDuplicates(object columns, XlYesNoGuess Header) //xlWorkSheet is the excel sheet
But I'm not sure how to use! specifically for the first argument.
How can I pass excel columns to this function?
Hope you can help,
Ali


Hemant KumarRank #1,202 · 1.5K reputationPosted Sep 25, 2011, 10:49 PM EDT
var myDictionary = new Dictionarystring,int>(); string col="C"; for(int row = 1; rownumberOfRows; ++row) { string elemValue = myWorkSheet.Range(col + row).Text; if(myDictionary.ContainsKey(elemValue)) { Console.WriteLine(col + myDictionary[elemValue] + " = " "+ col + row); } else { myDictionary[elemValue]=row; } }John Spencer5 reputationPosted Jun 21, 2019, 8:34 AM EDT