If you do not know in advance:
a) the number of rows
b) the number of columns
c) the quantity of leaves
Follow these steps:
Code:
which is supposed to start the sheet is blank, no details.
'Here I tell VBA that from cell A1, go to the end (end), down' (xlDown) and I return the nro row. I do the same thing towards the end and to the right
'to determine the number of existing columns:
TotalFilas = Cells (1,1). End (xlDown). Row
TotalColumnas = Cells (1,1). End (xlRigth). Column
'or a much easier:
TotalFilas = ActiveSheet.Rows.Count
TotalColumnas = ActiveSheet.Columns.Count
'to the total leaf from the book:
TotalHojas = ActiveWorkbook.Sheets.Count
next you're driving the leaves and if necessary, add sheets
Bookmarks