LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Help - simple but doesn't work.

Hi,

I'm a very occasional (and not very good) VBA user in a company where nobody
else seems to. I can usually muddle my way through using google and a big
stack of books, but have come unstuck on something which really should be
very simple.

My intention was to produce some code which cycles through all worksheets in
the active workbook (they're all iterations of the same thing) and gets it
all formatted for printing.

I've come up with the following code:

Sub printy_thingy()

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Select

ws.Activate


ws.PageSetup.PrintArea = "$A$1:$T$141"
With ws.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 3
End With
ws.ResetAllPageBreaks
Set ws.HPageBreaks(1).Location = Range("A65")
Set ActiveSheet.HPageBreaks(2).Location = Range("A114")

Next ws

End Sub


Unfortunately, the lines:
Set ws.HPageBreaks(1).Location = Range("A65")
Set ActiveSheet.HPageBreaks(2).Location = Range("A114")
....just don't work. I get error messages when I try to execute them (Excel
2002).

Anybody know why this is happening and how to fix it?

Cheers in advance.
 
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
So simple, but I can't get it to work hmsawyer Excel Discussion (Misc queries) 4 April 5th 08 07:58 AM
simple deletion won't work for me jgriffs Excel Discussion (Misc queries) 2 January 29th 06 09:55 PM
Simple but I can't get it to work? PLEASE help!! Naji Excel Discussion (Misc queries) 6 January 11th 06 10:27 PM
Its so simple! Why won't it work! Kevin O'Neill[_2_] Excel Programming 4 November 9th 05 11:02 PM
Why does this simple thing not work? Peter[_55_] Excel Programming 4 September 22nd 05 06:40 PM


All times are GMT +1. The time now is 06:59 AM.

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"