Hello,
As i am new to C# programming i came across this problem.
I need to open an XL file find the cell which contains a particluar string.
But the problem i face is when there are more than one instances of the same string in different cells.
Eg: if cell [1,1] has "test" and cell [12,5] also has "test" then i get the returned value at [12,5] but i want [1,1], can any one please help me out how i can start searching from [1,1] which includes the cell [1,1].
Following is the snippet.
Excel.Application XLFile = new Excel.Application();
Excel.Workbook XLworkbook;
Excel.Worksheet XLSheet;
XLworkbook = XLFile.Workbooks.Open(@"C:\temp.xls",
2,
true,
5,
"",
"",
true,
Excel.XlPlatform.xlWindows,
0,
false,
false,
false,
false,
true,
Excel.XlCorruptLoad.xlNormalLoad);
XLSheet = (Excel.Worksheet)XLFile.ActiveSheet;
Excel.Range FindCell;
object Missing = System.Reflection.Missing.Value;
FindCell = XLSheet.Cells.Find("test", issing, Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlWhole, Excel.XlSearchOrder.xlByColumns, Microsoft.Office.Interop.Excel.XlSearchDirection.xlNext, true, false, false);