Private fMaxRow As Integer Private fMaxCol As Integer Private ExcelHWD As Excel.ApplicationfMaxRow = ExcelHWD.Selection.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Rows.RowfMaxCol = ExcelHWD.Selection.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Columns.Column