Thread: using formuals
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bobt Bobt is offline
external usenet poster
 
Posts: 84
Default using formuals

Assuming you can base the print area selection on another column (e.g. sure
column A has 200 values but column B will always - and only - have a value
for each row we want to print), then you can set up a "Set_My_Print_Area"
macro like this:

Sub Set_My_Print_Area()

Dim StartCell As String
StartCell = "A1" 'Whatever the upper left corner of the page range will be.
Range("B1").Select 'the column I mentioned earlier that we can use as our
test.
'Find the last row
Selection.End(xlDown).Select

'Now set the print area. Change the "G" to whatever the last column is you
want to print.
ActiveSheet.PageSetup.PrintArea = StartCell & ":" & "G" & ActiveCell.Row

End Sub

"hshayhorn" wrote:

I have a repeating IF statement running down column A for 200 rows. I'm
making an assumption that I will not need more than 200 rows ever but I have
no idea how many rows I may need. My issue is thta because of the 200 rows
being used by the formula when I print the worksheet it prints all 200 rows
now just the rows that have real data. If there a way besides having the user
set the print area to only print rows with real data??