<pre> Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook sheet = excel.Workbooks.Open("C:\\Data\\Enrolled.xlsx"); Microsoft.Office.Interop.Excel.Worksheet x = excel.ActiveSheet as Microsoft.Office.Interop.Excel.Worksheet; int i = 0; for (i = 1; i <= lastRow; i++) { // Conditional Needed to check if column row has a "N" if (excel.WorksheetFunction) (x.Rows[i] as Microsoft.Office.Interop.Excel.Range).Delete(); } sheet.Close(true, Type.Missing, Type.Missing); excel.Quit();
for (i = lastRow; i>=1; i--) { /* your code */ }
... if (x.Range["A" + i].Value == "N") { ...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)