KnoxBear832
New Member
- Joined
- Aug 25, 2014
- Messages
- 4
Anyone know how to set Print Title Rows that may vary from worksheet to worksheet?
Example Worksheet:
<tbody>
</tbody>
In this example, Rows 1 thru 25 should be the print titles, but this data may be up or down a few rows on future versions of the workbook.
So, I did a find on "VAT", selected the next cell down, then defined the active row as "EndRowNumber". Then tried to set the Print Title Rows as 1:EndRowNumber, which returned an error. (Unable to set the PrintTitleRows propery of the PageSetup class).
Any ideas or suggestions would be greatly appreciated!!
Example Worksheet:
22 | Terms: | NE… |
23 | Due Date: | 09… |
24 | VAT/Tax ID Number: | 20… |
25 |
<tbody>
</tbody>
In this example, Rows 1 thru 25 should be the print titles, but this data may be up or down a few rows on future versions of the workbook.
So, I did a find on "VAT", selected the next cell down, then defined the active row as "EndRowNumber". Then tried to set the Print Title Rows as 1:EndRowNumber, which returned an error. (Unable to set the PrintTitleRows propery of the PageSetup class).
Any ideas or suggestions would be greatly appreciated!!
Code:
Cells.Find(What:="VAT", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Selection.Offset(1, 0).Select
Dim EndRowNumber As Integer
EndRowNumber = ActiveCell.Row
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = "1:EndRowNumber"
.PrintTitleColumns = ""
End With