with oExcel.ActiveWorkbook .ActiveSheet.Range('A1:T30').Select .SaveAs(lcFileName,8) endwith * Saves only 29 rows - 1 header + 29 rows with oExcel.ActiveWorkbook * .ActiveSheet.Range('A1:T30').Select && and no selection .SaveAs(lcFileName,8) endwith *Saves all data. The start-end row/column doesn't matter, excel finds itHowever if you really have to find out rowcount, colcount, address etc here are some usefull ones :
#define xlA1 1 #define xlLastCell 11 with oExcel.Activeworkbook.ActiveSheet lcLastCell = .Range("A1").SpecialCells(xlLastCell).Address(.f.,.f.,xlA1) ? 'Last Cell',lcLastCell with .UsedRange ? 'Address',.Address(.f.,.f.,xlA1) ? 'Rows',.Rows.Count, 'Cols', .Columns.Count endwith .Range("A1").SpecialCells(xlLastCell).CurrentRegion.Select endwithPS: UsedRange doesn't mean a range starting from 'A1'. If say you only had data in M5:U90 it means that part. Without a selection is made SaveAs defaults to this range and for that reason even if your data was in M5:U90 it's saved properly.