hi Liam, i dont think you need a macro for this. an OFFSET formula would be able to help you.
do you have a column that is definitely filled up (preferably numbers)? any row which is not filled means it should not be printed

if you have something i mentioned (maybe it's column A), you can use:
=OFFSET($A$1,0,0,COUNT(A1:A5000),20)

if your true/false is in column U, try:
=OFFSET($A$1,0,0,MATCH(TRUE,U1:U5000,0)-1,20)

Press CTRL + F3 to go to the Named Range. use either of the formula above to put inside PrintArea Named Range.

do upload a sample if it can't work.