dynamic PrintArea development

Chuck6475

Board Regular
Joined
Sep 30, 2012
Messages
126
2003 / w7

I have several Advanced filters that differ naturally by length not by width. I'm using a routine to group pages and print a single PDF. It works fine. Now for the "touchy feely" stuff. I'd like to eliminate the unnecessary printed "rows" from the print area.

Code:
    'GROSS SKINS
        If checkGskinsbyflight Then
            With Sheets("AFlightG")
                .Visible = True
                .Select
                 
                 Range("AF15").Select
                 Range("RawScores").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
                     Range("AD1:Ag2"), CopyToRange:=Range("A10:AC10"), unique:=False
                     
                FinalRow = .Cells(Application.Rows.Count, 2).End(xlUp).Row
                finalcol = .Cells(10, Application.Columns.Count).End(xlToLeft).Column
                Set rnData = .Cells(1, 1).Resize(FinalRow, finalcol)
            
                .PageSetup.PrintArea = rnData
                
            End With
                     Else
                     
                     Sheets("AFlightG").Visible = False
                     End If

As you can tell by the question, it isn't working. I know someone out there will do it in 4 lines and someone else in 2. AND they will work. You people are amazing!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Okay so I made it harder than it had to be,

This worked fine........
Code:
                FinalRow = .Cells(Application.Rows.Count, 2).End(xlUp).Row
                .PageSetup.PrintArea = "$A$1:$ac$" & FinalRow
 
Upvote 0

Forum statistics

Threads
1,226,693
Messages
6,192,460
Members
453,725
Latest member
cvsdatreas

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top