I can't understand what the code is supposed to be doing.
When I run it on a blank workbook it produces an overflow error, I even get
overflow values if I put in some values.
However, I do not know what values are required.
I am fairly convinced there is an easier way to do what you want - if we knew
what it was.
The reason it takes a long time could be that, having hidden rows with key
data in them, when it runs again it is unable to read the data it needs. It
then spends "forever" hiding all the blank rows on spreadsheets Sheet1 and
Sheet13. In my setup the integer value for i runs out when it reaches 32768
and an overflow results. Ohterwise it would hide all the rows to the end of
the spreadsheet.