Do you mean the last used row?
You can record a macro setting the print area, then substitute your variable in the string.
ActiveSheet.PageSetup.PrintArea = "$E$1:$E$" & lr
Can you post the code that you've got now and explain if you want to look at both rows and columns being dynamic, or just one or the other?