Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Dynamic Print Area

I need to set the print area for an ever changing range of rows (may start at
row 200 on one execution, may start at Row 300 on the next), but no wider
than Column G. The length of the Print Area is also ever changing, therefore
I have used a formula that finds the last occupied row.

I made some changes to the .Range () and now it no longer finds the last
occupied row (finds all BUT the last row). IF 8 rows are occupied, THEN
output is 7 rows.

Can anyone see what I'm doing wrong?

Sub Print_Preview()

Dim SH As Worksheet
Dim rng As Range
Dim LRow As Long
Dim BldRngeTop 'First cell in Print Area
Dim BldRngeWdth 'Last Column in Print Area

BldRngeTop = Range("Extract_Area_FirstCell").Address
BldRngeWdth = "G"

Set SH = ActiveSheet

With SH
LRow = SH.Cells(Rows.Count, BldRngeWdth).End(xlUp).Row
Set rng = .Range(BldRngeTop & ":" & BldRngeWdth & LRow)
.PageSetup.PrintArea = rng.Address
End With

ActiveWindow.SelectedSheets.PrintPreview
End Sub

Thanks for any help you might give.
--
FirstVette52
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
Dynamic Print Area FirstVette52 Excel Programming 5 February 19th 09 03:39 PM
Dynamic Print Area FirstVette52 Excel Programming 0 February 10th 09 07:34 PM
Dynamic Print Area Huddle Excel Discussion (Misc queries) 7 February 7th 07 04:55 PM
dynamic print area GeorgeW Excel Worksheet Functions 7 February 23rd 06 06:11 PM
Dynamic print area Harley Excel Programming 3 November 10th 05 01:11 PM


All times are GMT +1. The time now is 06:58 PM.

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

About Us

"It's about Microsoft Excel"