View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rosie189 Rosie189 is offline
external usenet poster
 
Posts: 2
Default print range bottom right cell

Thanks Héctor. I'll incorporate your routine.

JLGWhiz, Thank you for also responding.

"Discussions" is such a great resource!
--



"Héctor Miguel" wrote:

hi, Rosie !

Is there a way to programaticlly determine the bottom right cell of the worksheet print range
when no print range has been declared.
I've tried using UsedRange but it doesn't recognize Shape Objects.
HPageBreaks and VPageBreaks tell me the top left but not the bottom right.
Thanks.


try a loop on your worksheet/s shapes collection (i.e.)

Sub Print_Area_NO_Data()
Dim n As Integer, mRow As Integer, mCol As Byte
With ActiveSheet
If .Shapes.Count = 0 Then Exit Sub
If .PageSetup.PrintArea < "" Then Exit Sub
mRow = .Shapes(1).BottomRightCell.Row
mCol = .Shapes(1).BottomRightCell.Column
For n = 2 To .Shapes.Count
With .Shapes(n)
If .BottomRightCell.Row mRow Then mRow = .BottomRightCell.Row
If .BottomRightCell.Column mCol Then mCol = .BottomRightCell.Column
End With
Next
End With
MsgBox "Last printing cell is: " & Cells(mRow, mCol).Address
End Sub

hth,
hector.