Macro to create "Print Area" based on new row /ran

ilcaa

Well-known Member
Joined
May 25, 2005
Messages
686
Hi I am trying to create a macro that will automatically highlights my current range (its dynamic and changes based on subtotals i select) and make it my "Print Area"

what i do now is; select g1:a1**, then shift&Ctrl&down arrow

**Note- I select g1 first, then though a1 because i have a continous column in G and not in a, so this allows me to select the entire range when i shift,ctrl, arrow down..**

the problem is..when i look at the macro its has a1:g37 as the print area (based on that particular sized range at that moment i created the macro)

I need something that can select my current range (whatever it is at the time and make THAT my new print area when i run this macro

any ideas. thanks. Max
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

ilcaa

Well-known Member
Joined
May 25, 2005
Messages
686
the part that i make it a print area is the easy one, all i do if go to file select "set as print area"


tha problem i am having is slecting the range as my print area, please read the post, i think you only read the title of my post. thanks
 

Macropheliac

Board Regular
Joined
Aug 26, 2005
Messages
165
:unsure:
I need something that can select my current range (whatever it is at the time and make THAT my new print area when i run this macro

My mistake. Try this:
Code:
ActiveSheet.PageSetup.PrintArea = Selection.Address

That line should do it. Does it not?
 

Forum statistics

Threads
1,141,670
Messages
5,707,731
Members
421,525
Latest member
carian1980

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
Top