Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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.
--

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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.
--

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default 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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference bottom left cell in a visible range [email protected] Excel Programming 1 March 22nd 07 04:50 PM
Find the bottom cell that contains a specific val in a range? amit Excel Worksheet Functions 2 January 24th 07 05:23 PM
bottom border every second cell in range cass calculator Excel Programming 3 August 17th 06 05:44 PM
Finding the bottom non-blank cell in a range Fenneth Excel Discussion (Misc queries) 7 July 6th 06 06:05 PM
how to print a row on the bottom of every page Punx Excel Discussion (Misc queries) 1 November 29th 04 04:20 PM


All times are GMT +1. The time now is 09:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"