Beispiel #1
0
        /// <summary>
        /// Clear the workbook
        /// </summary>
        public static void zapWorksheet(Excel.Worksheet Wks, int intFirstRow = 2)
        {
            Excel.Range xlCell;

            // Wks = Wkb.ActiveSheet;

            int intLastRow = CommonExcelClasses.getLastRow(Wks);

            xlCell = Wks.get_Range("A" + intFirstRow + ":A" + intLastRow);

            if (Wks.Name != "InternalParameters")
            {
                if (intLastRow > intFirstRow)
                {
                    xlCell.EntireRow.Delete(Excel.XlDirection.xlUp);
                }
            }
            else
            {
                CommonExcelClasses.MsgBox("Cannot run in worksheet: InternalParameters", "Error");
            }
        }