iRows=activesheet.usedrange.rows.countiColumns=activesheet.usedrange.Columns.count'如果表格前面的几行或几列可能是空的,需要获得最下面的行数和最右面的列数:with activesheet.usedrange iEndRow=.rows.count+.row-1 iEndColumn=.Columns.count+.column-1end with