Print range arguments

Troy

New Member
Joined
Apr 2, 2002
Messages
47
I want to set a print range from b3 to activecell. I can't get the syntax right. Should I name the range first? That didn't seem to work either. Any suggestions? Thanks.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
L

Legacy 98055

Guest
Hi
Select your range and then type "Print_Area" in the "Name Box" directly above A1.

If you are speaking in terms of VBA, then use the following line:

ActiveSheet.PageSetup.PrintArea = Selection.Address

Tom
 
Upvote 0

Troy

New Member
Joined
Apr 2, 2002
Messages
47
For some reason I can't grasp the concept of creating a range. My range is not selected, only the last cell. I tried several instances of:
ActiveSheet.PageSetup.PrintArea = "$B$3:Active.cell"
or
= "$B$3:Active.cell.address"
 
Upvote 0
L

Legacy 98055

Guest
Now I get it.

Sub SetPrint()
ActiveSheet.PageSetup.PrintArea = Range("B3:" & ActiveCell.Address).Address
End Sub

Example:
ActiveCell is cell N22
ActiveCell.Address = "$N$22"
MyRangeAddress = "B3:" & ActiveCell.Address
MyRangeAddress = "B3:N22" or actually "B3:$N$22"
PrintArea = Range("B3:N22").Address

This would work too.
ActiveSheet.PageSetup.PrintArea = "B3:" & ActiveCell.Address

Tom
This message was edited by TsTom on 2002-08-26 05:25
 
Upvote 0

Forum statistics

Threads
1,191,368
Messages
5,986,256
Members
440,015
Latest member
knijgh

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