Thread: date problem
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default date problem

Try to insert this in the workbook code window (it supposes that cell in the
last written row in column A is not empty):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
lastrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
ActiveSheet.PageSetup.PrintArea = "$A$3:$F$" & lastrow
End Sub

Regards,
Stefi

€˛puiuluipui€¯ ezt Ć*rta:

THANKS MIKE, STEFI, IT'S WORKING. BOTH OF THEM.

I have one more problem. I need to print the worksheet but i need the macro
to autoajust the print area. I need to print 6 columns from A3 till the last
written row.

I don't want to set a print area, i just want to automatically print the
worksheet. Sometimes the worksheet has 10 rows and sometimes 100 rows.
Can you help me?
THANKS ALLOT