ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting page breaks based on value & printing to and from value (https://www.excelbanter.com/excel-programming/402796-setting-page-breaks-based-value-printing-value.html)

thomsonpa

setting page breaks based on value & printing to and from value
 
I am completely baffled as to whether this is possible.

I need a sheet to set page breaks to a maximum of 13 columns, then if the
value in column B is more than 04.00 (time value), insert a page break there.
This can be less than 13 columns. Then I need it to print the number of
pages up to this page break.
Next I need to continue from the 04.00 page break, and work down to 18.00,
doing the same thin, then print those pages (excluding the ones from the
beginning to 04.00.
Then a third run continuing to the end. From 18.00 to the end. Printing the
remaining pages.

Is this at all possible, or am I asking too much from excel.


thomsonpa

setting page breaks based on value & printing to and from value
 
I have figured out a way around this now, by looking up the value and if true
inserting "A" in a column, then using the following code, I can hide the rows
not needed to print.
Sub printrange3()




Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With


With ActiveSheet
.Select
ActiveWindow.View = xlNormalView


.DisplayPageBreaks = False


Firstrow = .UsedRange.Cells(7).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row


For Lrow = Lastrow To Firstrow Step -1


With .Cells(Lrow, "AL")

If Not IsError(.Value) Then

If .Value < "A" Then .EntireRow.Hidden = True

End If

End With

Next Lrow

End With



With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub

However, now I am wondering if it is possible to use this on every third
cell down in a column? ie. miss out 2 rows in each step.


"thomsonpa" wrote:

I am completely baffled as to whether this is possible.

I need a sheet to set page breaks to a maximum of 13 columns, then if the
value in column B is more than 04.00 (time value), insert a page break there.
This can be less than 13 columns. Then I need it to print the number of
pages up to this page break.
Next I need to continue from the 04.00 page break, and work down to 18.00,
doing the same thin, then print those pages (excluding the ones from the
beginning to 04.00.
Then a third run continuing to the end. From 18.00 to the end. Printing the
remaining pages.

Is this at all possible, or am I asking too much from excel.



All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com