Question

Locked

I need to set a dynamic print area without using dates as the reference

By nicci123 ·
I was able to have a dynamic print area in excel using this code, and adding dates to my table, but is there a way for me to change the code slightly to allow a dynamic print area using numbers, text, or the fact the cell isn't blank instead of dates/ the IsDate function?

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

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums