View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Print Area to include text box

Hi Paul,

Am Tue, 6 Jan 2015 05:51:45 -0800 (PST) schrieb Paul Doucette:

How can I set a print area on Sheet 1 from A1 (upper left) to the lower right corner of a text box regardless of where the text box is located?


the height of your textbox is 3 rows, the width is 3 columns.
Then try (modify the textbox name):

Sub PrintArea()
Dim LRow As Long, LCol As Long
Dim LCell As Range

With ActiveSheet
LRow = .Shapes("textbox21").TopLeftCell.Row + 3
LCol = .Shapes("textbox21").TopLeftCell.Column + 3
Set LCell = .Cells(LRow, LCol)
.PageSetup.PrintArea = .Range(.Cells(1, 1), LCell).Address
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional