Print Area Macro Question

V

Vick

I'm using a macro worksheet change macro, so that when ever someone changes a
pivottable the sheet will automatically change the print area of the pivot
table. I'm trying the following code, but everytime I try and record I get a
fixed value as you see here. How can I get the print area to use the range I
selected above?

Range("E10").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.PageSetup.PrintArea = "$E$10:$P$32"

Thanks
 
B

Bernard Liengme

Change last statement to:
ActiveSheet.PageSetup.PrintArea = ActiveCell.CurrentRegion.Address
best wishes
 
B

Bernard Liengme

But this seems to be OK
ActiveSheet.PageSetup.PrintArea = ActiveWindow.RangeSelection.Address
best wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top