![]() |
print range bottom right cell
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. -- |
print range bottom right cell
From what I have been able to determine, the print area and the page break
have no relationship, except that the print area is contained within the page break areas. Perhaps if you were more elaborate in what you want to do, someone could offer a suggestion. "Rosie189" wrote: 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. -- |
print range bottom right cell
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. |
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. |
All times are GMT +1. The time now is 09:43 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com