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
 

Some videos you may like

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

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?
 

Watch MrExcel Video

Forum statistics

Threads
1,114,043
Messages
5,545,689
Members
410,698
Latest member
Wloven
Top