4 replies
by marta Accepted solution
by fwang Accepted solution
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
by nicci123 Accepted solution
I need to do the same thing, and I got this code to work for my spreadsheet if I add dates to it, but can I do this using a number or text or the fact that the cell isn't blank instead?
Thanks,
Nic
Here is the code again just in case:
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
by tobif Accepted solution
You've revived an old thread to ask a question about how to do something like the same, but differently.
Ask your own question. (Especially that you even include the code, and/or you could give a link to the inspirational thread).
The reason I'm suggesting this is that your question indicates that your question is a bit unspecific and we may get a discussion about the most convenient way to handle your particular case.
This discussion is closed to new replies.
Trending Software posts
Sort by Trending