i have excel file 2 sheets. sheet containing formatted report , sheet b containing raw data.
on sheet b there table can 1 n rows. table shown on page on sheet (derived).
how can autmatically create new page on sheet a, if table in sheet b contains more rows table in sheet can hold?
not quite sure why you're doing might work:
private sub worksheet_selectionchange(byval target range) dim ws worksheet dim tbl listobject dim maxrows integer set ws = thisworkbook.sheets("sheetb") 'change worksheet name set tbl = ws.listobjects(1) maxrows = 22 'number of max rows in table if tbl.listrows.count > maxrows ' add code add new 'page on sheet a' end if end sub
this run on change within sheetb (place code in worksheet module) count number of entries in table on sheet b before running whatever code if has exceeded maximum number.