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: 1
Default Print Code not working


Hi, Im trying to work this so that when the user selects a check box an
enters in the cell next to it the number of copies, that the code wil
print 3 pages per each worksheet that was selected. For some reason
can't see why the code is not working. All the code does is print ou
blank sheets, and for example, it prints 9 regular sized sheets for th
first section, which should be 1 legal size. Any ideas?

Private Sub PrintSelAnal_Click()

Dim area As String
Dim startrow1 As Integer
Dim startcol1 As Integer
Dim endrow1 As Integer
Dim endcol1 As Integer
Dim startrow2 As Integer
Dim startcol2 As Integer
Dim endrow2 As Integer
Dim endcol2 As Integer
Dim startrow3 As Integer
Dim startcol3 As Integer
Dim endrow3 As Integer
Dim endcol3 As Integer

fstyr = Range("FirstAll")
lstyr = Range("LastAll")

If CheckBox12.Value = True Then

For i = 1 To Cells(18, 9).Value

Sheets(Cells(18, 6).Value).Select

' for q 1 and q 2

startrow1 = 1
startcol1 = 20
endrow1 = 56 + 2 * (lstyr - fstyr)
endcol1 = 46
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Range(Cells(startrow1, startcol1), Cells(endrow1
endcol1)).PrintOut copies:=1, Collate:=True

' for q3 and q4
startrow2 = (endrow1 + 1)
startcol2 = 20
endrow2 = startrow2 + 42 + 2 * (lstyr - fstyr)
endcol2 = 46
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Range(Cells(startrow2, startcol2), Cells(endrow2
endcol2)).PrintOut copies:=1, Collate:=True

' for rest

startrow3 = 21
startcol3 = 48
endrow3 = 124
endcol3 = 59
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Range(Cells(startrow3, startcol3), Cells(endrow3
endcol3)).PrintOut copies:=1, Collate:=True

Next i

End If


THANK YPU SO MUCH

--
Sheen
-----------------------------------------------------------------------
Sheeny's Profile: http://www.excelforum.com/member.php...nfo&userid=908
View this thread: http://www.excelforum.com/showthread.php?threadid=54027

 
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 Fit To Not Working jutlaux Excel Discussion (Misc queries) 1 August 27th 08 09:42 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
print preview not working Shannon Excel Discussion (Misc queries) 0 June 9th 05 11:17 PM
before print event not working goss[_17_] Excel Programming 2 January 29th 04 03:54 AM


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