Hi there,
Try inserting the following code into the "ThisWorkbook" VBA CodeModule:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Const sCOLUMN_TO_CHECK As String = "G:G"
Const sPRINT_AREA As String = "$B$1:$G$"
Dim rLastCell As Range
Dim iLastRow As Integer
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
Set rLastCell = wks.Columns(sCOLUMN_TO_CHECK).Cells(1, 1)
Do While rLastCell.Offset(1, 0).Value <> vbNullString
Set rLastCell = rLastCell.Offset(1, 0)
Loop
iLastRow = rLastCell.Row
wks.PageSetup.PrintArea = sPRINT_AREA & iLastRow
Next wks
End Sub
Hope this helps - please let me know how you get on.
Regards,
Greg M
Bookmarks