View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2349_] Rick Rothstein \(MVP - VB\)[_2349_] is offline
external usenet poster
 
Posts: 1
Default Print Range Question

Try this macro...

Sub SetPrintArea()
Dim C As Range
With Worksheets(2)
Set C = .Range("A:A").Find(What:=0, LookIn:=xlValues, LookAt:=xlWhole)
If Not C Is Nothing Then
.PageSetup.PrintArea = "$A$1:$F$" & C.Offset(-1).Row
End If
End With
End Sub

Rick


"John" wrote in message
...
I am trying to develp a macro that will set the Print Range in a worksheet.
I
have tried to modify several macos on the forums with no success. The
problem
is I need to count down to the bottom of column A (which does contain some
blanks), to the first row that contains 0. Then I want the macro to set
the
Print Range to A1:FX, where X is equal to the last row before the 0.

Thanks in advance! (Using Excel 2003)