lmmay
Board Regular
- Joined
- Jun 6, 2014
- Messages
- 87
I am trying to use the following to print a multiple page worksheet.
Can not figure out what my error is.
Can not figure out what my error is.
VBA Code:
Sub Set_Print_Area()
'Unprotect Worksheet
ActiveSheet.Unprotect Password:="XXXXXXXe"
'Set Print and Review
Dim c As Range
Dim FirstAddress As String
Set c = Columns("B").Find(What:="APPLICANT NAME:", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=c.Offset(0)
Set c = Columns("B").FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAddress
End If
x = ActiveSheet.UsedRange.Columns.Count
Set lastCell = Cells.SpecialCells(xlCellTypeLastCell)
ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1), lastCell).Address
ActiveSheet.Range("Q2655").End(xlUp).Select
ActiveSheet.PrintPreview
Last edited by a moderator: