Nested tables. Count rows
I have a series of tables with nested tables. There may be more than one nested table in each primary table cell.
I want a procedure that counts the number of rows in whichever table is the current selection (assuming it is a nested table). I know how to verify it is nested, so that is not the problem.
Once I know the number of rows, I want to number from cell(2,1) - below the header - by entering text "1. ", movedown, "2. " etc. Think I can do that if I can identify the nested table.
Problem is that a primary table might have two or three nested tables in one cell. If the cursor is in nested table 2, I can use:
intRowNos = Selection.Tables(1).Tables(2).Rows.Count
but how do I cater for the fact it could be in Tables(2) or (1) or even (3)?
|