You would just need to change myrng and the two hidden properties.

Before printout:
Dim cell as Range, myrngRow as Range, myrowCol as Range
set myrngRow = Range("A1:A" & Range("B65536").End(xlUp).Row)
set myrngCol = Range("A1:" & Range("IV1").End(xlToLeft).Column & "1")

For Each cell In myrngRow

    If cell = "" Then cell.EntireRow.Hidden = True
    
Next cell

For Each cell In myrngCol

    If cell = "" Then cell.EntireColumn.Hidden = True
    
Next cell
After printout:
For Each cell In myrngRow

    cell.EntireRow.Hidden = False
    
Next cell

For Each cell In myrngCol

    cell.EntireColumn.Hidden = False
    
Next cell