Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2003 - Printing Non-Continuous Rows In Spreadsheet

Status
Not open for further replies.

TypeIV

Structural
Jun 28, 2004
27
0
1
US
I have a spreadsheet that shows some reinforcing choices in a few rows and I would like to have them visible to the user, but not print them in the output. What is the simplest way to do this? (FYI: There are hidden rows in the spreadsheet.)

Thanks
 
Replies continue below

Recommended for you

Can you set the print area to not include the rows that are not to be printed? File/Print Area/Set Print Area...

Wheels within wheels / In a spiral array
A pattern so grand / And complex
Time after time / We lose sight of the way
Our causes can't see / Their effects.

 
I tried to do that, but the rows are in the middle of the spreadsheet and the print preview showed that it started a new page on either side of where I stopped and started the PRINT AREA. Now that could be because I have title rows repeating at the top of each page.
 
You could put the non-printing stuff in a comment. Use Tools|Options|View|Comments & Indicator to make the comments visible and File|Page Setup|Sheet|Comments (None) to make the comments not print.
 
This used to be a feature in Lotus that many people loved, which you can't do in excel without special programming.

Make a button, and modify the below macro to fit your needs inside the button. Basically this is how it works.
In my case if my line item sum = 0, then my column A = |.
Then the macro goes through and hides the all the rows temporarly that the | temprorarly. It then prints the page.
Then unhides all the rows it just printed.



Sub LotusPrint()
Dim UnhideRow() As Single
Application.ScreenUpdating = False
' Locate the final row in column A
FinalRow = Range("A65536").End(xlUp).Row
Ctr = 0
' Check and hide each row that starts with a pipe
For x = 1 To FinalRow
If Left(Range("A" & x).Value, 1) = "|" Then
' Do nothing if the row is already hidden
If Not Range("A" & x).EntireRow.Hidden Then
Range("A" & x).EntireRow.Hidden = True
' Save the row number so that it can be unhidden
Ctr = Ctr + 1
ReDim Preserve UnhideRow(Ctr)
UnhideRow(Ctr) = x
End If
End If
Next x
' Print the sheet
ActiveWindow.SelectedSheets.PrintOut
' Unhide any hidden rows
If Ctr > 0 Then
For x = 1 To Ctr
Range("A" & UnhideRow(x)).EntireRow.Hidden = False
Next x
End If
Application.ScreenUpdating = True
End Sub

Hopes this works for you.
 
Status
Not open for further replies.
Back
Top