Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Setting print range with macro

I am trying to clear a sheet of all print range and page breaks...then set
the print range and tell it where to page break both vertical & horizontal.
Can someone please give me basic code for setting the print range and
adjusting the page breaks. Print range: A1:Q154 and the page break must be
set to row 96. 1page wide by 2 pages tall. Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Setting print range with macro

if you set it to print 1 page wide by 2 pages tall, your pagebreak will be
ignored (unless that just happens to be where it would calculate the
pagebreak.

activesheet.PageSetup.PrintArea = range("A1:Q154").Address(True,True,,True)

You can get the rest by doing pagesetup with the macro recorder turned on.
In looking at the recorded code, you only want to execute settings you
actually need.

--
Regards,
Tom Ogilvy


"Deeds" wrote in message
...
I am trying to clear a sheet of all print range and page breaks...then set
the print range and tell it where to page break both vertical &

horizontal.
Can someone please give me basic code for setting the print range and
adjusting the page breaks. Print range: A1:Q154 and the page break must

be
set to row 96. 1page wide by 2 pages tall. Thanks in advance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Setting print range with macro

Thanks Tom,
I got something to work by looking at the recorder....next question what
do I put in so that the user can't see it jump to the sheet and do all the
page setup....is there a way to have it just sit at the front sheet while it
is doing it's work in the background?...Thanks again.

"Tom Ogilvy" wrote:

if you set it to print 1 page wide by 2 pages tall, your pagebreak will be
ignored (unless that just happens to be where it would calculate the
pagebreak.

activesheet.PageSetup.PrintArea = range("A1:Q154").Address(True,True,,True)

You can get the rest by doing pagesetup with the macro recorder turned on.
In looking at the recorded code, you only want to execute settings you
actually need.

--
Regards,
Tom Ogilvy


"Deeds" wrote in message
...
I am trying to clear a sheet of all print range and page breaks...then set
the print range and tell it where to page break both vertical &

horizontal.
Can someone please give me basic code for setting the print range and
adjusting the page breaks. Print range: A1:Q154 and the page break must

be
set to row 96. 1page wide by 2 pages tall. Thanks in advance!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Setting print range with macro

With Worksheets("Sheet3").PageSetup


End With


rather than

With Activesheet.PageSetup

and take out any activate or select commands

--
Regards,
Tom Ogilvy


"Deeds" wrote in message
...
Thanks Tom,
I got something to work by looking at the recorder....next question

what
do I put in so that the user can't see it jump to the sheet and do all the
page setup....is there a way to have it just sit at the front sheet while

it
is doing it's work in the background?...Thanks again.

"Tom Ogilvy" wrote:

if you set it to print 1 page wide by 2 pages tall, your pagebreak will

be
ignored (unless that just happens to be where it would calculate the
pagebreak.

activesheet.PageSetup.PrintArea =

range("A1:Q154").Address(True,True,,True)

You can get the rest by doing pagesetup with the macro recorder turned

on.
In looking at the recorded code, you only want to execute settings you
actually need.

--
Regards,
Tom Ogilvy


"Deeds" wrote in message
...
I am trying to clear a sheet of all print range and page breaks...then

set
the print range and tell it where to page break both vertical &

horizontal.
Can someone please give me basic code for setting the print range and
adjusting the page breaks. Print range: A1:Q154 and the page break

must
be
set to row 96. 1page wide by 2 pages tall. Thanks in advance!






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Setting print range with macro

Thanks much! Works.

"Tom Ogilvy" wrote:

With Worksheets("Sheet3").PageSetup


End With


rather than

With Activesheet.PageSetup

and take out any activate or select commands

--
Regards,
Tom Ogilvy


"Deeds" wrote in message
...
Thanks Tom,
I got something to work by looking at the recorder....next question

what
do I put in so that the user can't see it jump to the sheet and do all the
page setup....is there a way to have it just sit at the front sheet while

it
is doing it's work in the background?...Thanks again.

"Tom Ogilvy" wrote:

if you set it to print 1 page wide by 2 pages tall, your pagebreak will

be
ignored (unless that just happens to be where it would calculate the
pagebreak.

activesheet.PageSetup.PrintArea =

range("A1:Q154").Address(True,True,,True)

You can get the rest by doing pagesetup with the macro recorder turned

on.
In looking at the recorded code, you only want to execute settings you
actually need.

--
Regards,
Tom Ogilvy


"Deeds" wrote in message
...
I am trying to clear a sheet of all print range and page breaks...then

set
the print range and tell it where to page break both vertical &
horizontal.
Can someone please give me basic code for setting the print range and
adjusting the page breaks. Print range: A1:Q154 and the page break

must
be
set to row 96. 1page wide by 2 pages tall. Thanks in advance!








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro in VBA: Setting a variable print range HELP NEEDED!! Ron de Bruin Excel Programming 1 July 21st 04 05:45 PM
Setting print range using VBA Dave Ramage[_2_] Excel Programming 0 July 29th 03 04:35 PM
Setting print range using VBA VBANut Excel Programming 0 July 29th 03 04:20 PM
Setting print range using VBA Ron de Bruin Excel Programming 0 July 29th 03 03:59 PM
Setting Print range Tom Ogilvy Excel Programming 3 July 25th 03 04:06 AM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"