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: 386
Default Print Code Help

Afternoon,

Hi I'm trying to get a code to cycle through sheets 4 to 11 to print out
certain sheets based on whether there is data in it or not, (the value in
cell AA273 is either 1 or 2). I'm trying to get the code to cycle through
the sheets automatically to print out the set ranges.

The code prints ok, but it will print sheet that I am currently on several
times rather than printing 4,5,6...11. In order to save some trees I have
shortened the range on the code I'm using as per below to try and only print
a few sheets until i get it to work. This code has printed twice sheet 11
and twice sheet 4 as I was on these sheets when i ran the code.

How do I get it to print each sheet once rather than one sheet loads of times?



Thanks
LiAD

ub PrintSheetsMacro()
'
Dim X As Long
For X = 10 To 11
Worksheets(X).Rows("111:214").EntireRow.Hidden = False
If [AA273].Value = 2 Then
Rows("267:274").EntireRow.Hidden = False
Range("C266:P325").Select
ActiveSheet.PageSetup.PrintArea = "$C$266:$P$325"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("C206:P265").Select
ActiveSheet.PageSetup.PrintArea = "$C$206:$P$265"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Rows("111:214").Select
Selection.EntireRow.Hidden = True
Rows("267:274").Select
Selection.EntireRow.Hidden = True
Range("B10").Select
Else
Range("C206:P265").Select
ActiveSheet.PageSetup.PrintArea = "$C$206:$P$265"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Rows("111:214").Select
Selection.EntireRow.Hidden = True
Range("B10").Select

End If

Next

End Sub
 
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
Print code Very Basic User Excel Discussion (Misc queries) 4 February 25th 10 09:08 PM
Differentiate between 'Print' and 'Print Preview' in VBA code Mattantaliss Excel Programming 4 April 17th 06 09:31 PM
Code before Print but not Print Preview widemonk Excel Programming 1 November 14th 05 01:48 PM
Need Code To Print From Code Modules davidm Excel Programming 0 June 7th 05 06:11 AM
Need Code To Print From Code Modules davidm Excel Programming 0 June 7th 05 06:08 AM


All times are GMT +1. The time now is 03:05 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"