-----Original Message-----
Roy
Making an assumption that the column will only extend to C the code below
finds the last row with data. Goes to row 65536 and looks up in columnA and
uses this to set the print area to that address.
You can use the relevant parts in your code
Sub setprintrange()
Dim lLastRow As Long
lLastRow = Range("A65536").End(xlUp).Row
Worksheets("Sheet1").PageSetup.PrintArea = Range("A1:C" & lLastRow).Address
End Sub
If the column differs you could use other methods in place of this. This
example from help region on Sheet1. Note
that you use the Address property to return an A1-style address.
Worksheets("Sheet1").Activate
ActiveSheet.PageSetup.PrintArea = _
ActiveCell.CurrentRegion.Address
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
.