Well currently, Excel has a limit of 2^16 rows. So you could use A2:M65535
Or you could count the number of rows you are going to pump into the excel file, by doing a SQL Execute statement to do a select count(*) from whatever where mycriteria = true
and put the output into a Global Variable. Then use the Global variable in your ActiveX script add 1 and that is your end.
Principal Consultant and Trainer