Question
Thread display: Collapse - |
All Answers
Share your knowledge
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
I need to set a dynamic print area without using dates as the reference
Thanks,
Nic
Here is the code from another post:
Assuming the data in your order starts from row 2 and the date is in column B, if not, change startrow and datecol accordingly:
Sub AutoHide()
Dim r As Integer, startrow As Integer, datecol As Integer
startrow = 2
datecol = 2
Application.ScreenUpdating = False
For r = Cells.SpecialCells(xlLastCell).Row To startrow Step -1
If (Not IsDate(Cells(r, datecol))) Then
Rows(r).EntireRow.Hidden = True
End If
Next
Application.ScreenUpdating = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Cells.EntireRow.Hidden = False
End Sub