Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.PrintArea 1

Status
Not open for further replies.

claudehenri

Technical User
May 31, 2003
48
0
0
AU
this is my code below
the .select command selects the area i want to set as the print area, but the ".PrintArea =" still returns the ".UsedRange" range. Doesn't make sense to me.

With Worksheets("Fly Chart")
.UsedRange.Resize(.UsedRange.Rows.Count, _
.UsedRange.Columns.Count - 2).Select
.PageSetup.PrintArea = .UsedRange.Resize _
(.UsedRange.Rows.Count, .UsedRange.Columns.Count - _
2)
End With
 
claudehenri
I don't know the specifics of how Excel assigns a print area automatically but I assume it to be the used range by default.

This, however, isn' really what you're problem is!

PrintArea is a Read/Write String. What you are trying to do is assign a Range to it.

What you could try is
.PageSetup.PrintArea = selection.address

Or better still (as it's not usually necessary to use select) you could do the whole thing in one line

.PageSetup.PrintArea = .UsedRange.Resize _
(.UsedRange.Rows.Count, .UsedRange.Columns.Count - 2).Address

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top