Billdub417
New Member
- Joined
- Nov 5, 2019
- Messages
- 45
Hello,
I'm trying to add a macro on a sheet to print preview the page, after hiding blank lines.
Id like the end result to be a print preview on 2 pages - 1st to cover A1:C449 and the second to show A450:C620
The below code works but it shows my data over 4 pages rather than 2 - is it possible to restrict it to 2 and scale to fit?
Glad of some help.
Thanks
I'm trying to add a macro on a sheet to print preview the page, after hiding blank lines.
Id like the end result to be a print preview on 2 pages - 1st to cover A1:C449 and the second to show A450:C620
The below code works but it shows my data over 4 pages rather than 2 - is it possible to restrict it to 2 and scale to fit?
Glad of some help.
Thanks
VBA Code:
Sub Hideandprint()
Dim cell As Range
For Each cell In Range("b6:b620")
If Not IsEmpty(cell) Then
If cell.value = 0 Then
cell.EntireRow.Hidden = True
End If
End If
Next
With Sheets("sheet1")
ActiveSheet.PageSetup.PrintArea = "a1:c449,a450:C620"
Sheets("sheet1").PrintPreview
End With
End Sub