LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Need help revising print range selection

Below is the code I am currently using to set the print range, header title,
and put a border around the selected print area. I need some help revising
the code to allow for a variable range. The beginning cell will always be
A1 (1, 1), but the lower left cell that defines the boundary of the print
area will change depending on data that is imported into the worksheet.
Column B will determine the row that will defines the last cell. It should
be two rows below the Cell in Column B that Contains the text "Target %
Comp." The same row will determine will determine the column for the last
cell. It will be one column over from the last cell that contains data on
the row where "Target % Comp." is located. All other cells on this row will
be blank.

For example: Now "Target % Comp." is in Row "41" and the last data is in
Column "AS", by going 2 rows down and one row to the left the last cell
should be AT43 as listed in the code below.


Sub SetPrintRange()
With Worksheets("Charts").PageSetup
.CenterHorizontally = True
.PrintArea = "$A$1:$AT$43"
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 1
.CenterHeader = "&""Arial,Regular""&22" & Range("b51").Value
Range("$A$1:AT43").BorderAround Weight:=xlThin
End With
End Sub


 
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
excel 2003 - revising a formula to make it more accurate Doug Excel Worksheet Functions 3 June 30th 08 12:54 AM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
"Print Selection" doesn't print beyond automatic page breaks Andre Excel Discussion (Misc queries) 3 October 30th 06 09:30 PM
How can I print frozen panes to appear above print selection in Ex Snr Franco Excel Discussion (Misc queries) 1 April 2nd 06 03:06 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM


All times are GMT +1. The time now is 09:22 PM.

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"