Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to accomplish Zoom and Fit to Simultaneously

Hello -
I currently have an excel workbook that contains multiple worksheets. Each
worksheet contains four sections (one right after the next) that all start
out with the same number of rows. All rows that total to zero are hidden,
making each worksheet and section different printing ranges. I need each
worksheet to print on four pages (one section on each) with the page breaks
at row 144, 283, and 422. Is it possible, and how would I go about, setting
the .fittopageswide = 1 and .fittopagestall = 4 and adjusting the page breaks
to the specified rows? It appears that I can only do one or the other. This
is messing up the zoom on some worksheets. I have the following code:

activewindow.view = xlpagebreakpreview (this is only here so that I can
watch my as I step through the code)

with activesheet.pagesetup
.fittopageswide = 1
.fittopagestall = 4
endwith
activesheet.resetallpagebreaks
set activesheet.hpagebreaks(1).location = range("E144")
set activesheet.hpagebreaks(2).location = range("E283")
set activesheet.hpagebreaks(3).location = range("E422")
activewindow.view = xlnormalview

I am sure that the reset all is taking away the fit to 1 by 4. Any
suggestions on how to accomplish this? Thanks in advance for your time.
CodeCrazy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Macro to accomplish Zoom and Fit to Simultaneously

The Resetallpagebreaks doesn't take away the 1x4 setting.. but you need to
set the zoom property to False, for the setting to apply.. Try:


With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 4
.Zoom = False
End With
ActiveSheet.ResetAllPageBreaks
ActiveSheet.HPageBreaks.Add Range("E144")
ActiveSheet.HPageBreaks.Add Range("E283")
ActiveSheet.HPageBreaks.Add Range("E422")
ActiveWindow.View = xlNormalView




--
Hope that helps.

Vergel Adriano


"CodeCrazy" wrote:

Hello -
I currently have an excel workbook that contains multiple worksheets. Each
worksheet contains four sections (one right after the next) that all start
out with the same number of rows. All rows that total to zero are hidden,
making each worksheet and section different printing ranges. I need each
worksheet to print on four pages (one section on each) with the page breaks
at row 144, 283, and 422. Is it possible, and how would I go about, setting
the .fittopageswide = 1 and .fittopagestall = 4 and adjusting the page breaks
to the specified rows? It appears that I can only do one or the other. This
is messing up the zoom on some worksheets. I have the following code:

activewindow.view = xlpagebreakpreview (this is only here so that I can
watch my as I step through the code)

with activesheet.pagesetup
.fittopageswide = 1
.fittopagestall = 4
endwith
activesheet.resetallpagebreaks
set activesheet.hpagebreaks(1).location = range("E144")
set activesheet.hpagebreaks(2).location = range("E283")
set activesheet.hpagebreaks(3).location = range("E422")
activewindow.view = xlnormalview

I am sure that the reset all is taking away the fit to 1 by 4. Any
suggestions on how to accomplish this? Thanks in advance for your time.
CodeCrazy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to accomplish Zoom and Fit to Simultaneously

That did it. Thanks so much!

"Vergel Adriano" wrote:

The Resetallpagebreaks doesn't take away the 1x4 setting.. but you need to
set the zoom property to False, for the setting to apply.. Try:


With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 4
.Zoom = False
End With
ActiveSheet.ResetAllPageBreaks
ActiveSheet.HPageBreaks.Add Range("E144")
ActiveSheet.HPageBreaks.Add Range("E283")
ActiveSheet.HPageBreaks.Add Range("E422")
ActiveWindow.View = xlNormalView




--
Hope that helps.

Vergel Adriano


"CodeCrazy" wrote:

Hello -
I currently have an excel workbook that contains multiple worksheets. Each
worksheet contains four sections (one right after the next) that all start
out with the same number of rows. All rows that total to zero are hidden,
making each worksheet and section different printing ranges. I need each
worksheet to print on four pages (one section on each) with the page breaks
at row 144, 283, and 422. Is it possible, and how would I go about, setting
the .fittopageswide = 1 and .fittopagestall = 4 and adjusting the page breaks
to the specified rows? It appears that I can only do one or the other. This
is messing up the zoom on some worksheets. I have the following code:

activewindow.view = xlpagebreakpreview (this is only here so that I can
watch my as I step through the code)

with activesheet.pagesetup
.fittopageswide = 1
.fittopagestall = 4
endwith
activesheet.resetallpagebreaks
set activesheet.hpagebreaks(1).location = range("E144")
set activesheet.hpagebreaks(2).location = range("E283")
set activesheet.hpagebreaks(3).location = range("E422")
activewindow.view = xlnormalview

I am sure that the reset all is taking away the fit to 1 by 4. Any
suggestions on how to accomplish this? Thanks in advance for your time.
CodeCrazy

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
How to accomplish this tkraju via OfficeKB.com Excel Discussion (Misc queries) 4 March 13th 10 06:17 PM
Please help! Print Preview Zoom is Grayed Out...Doesn't zoom. PK Excel Discussion (Misc queries) 0 July 20th 09 03:33 PM
How do I accomplish this? scheduler Excel Worksheet Functions 2 October 26th 06 06:40 PM
What's the best solution to accomplish this? WDR Excel Programming 4 January 16th 06 05:52 AM
How can a accomplish these tasks properly??? Frantic Excel-er Excel Discussion (Misc queries) 0 June 20th 05 09:10 PM


All times are GMT +1. The time now is 07:33 PM.

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

About Us

"It's about Microsoft Excel"