Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code is not working


Hi,

For some reason my code is not working, I am trying to print out sheet
based on what the main page selections are. ie. On the main sheet ther
are checkboxes, beside each checkbox is the name of the sheet in a cell
Then there is a checkbox, and then in the cell next to that, there is
spot to enter how many copies you need. For some reason, its onl
printing out blank white pages (my printer is fine). I think it
picking up the range right. Also its printing letter sheets when i'v
asked for llegal...any ideas?

Here is an idea for one checkbox...

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

'Do all except Vern

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

If CheckBox12.Value = True Then
num = 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 Sheets(Cells(18, 6).Value).PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLegal
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Range(Cells(startrow1, startcol1), Cells(endrow1
endcol1)).PrintOut Copies:= num, Collate:=True

' for q3 and q4
startcol2 = 20
startrow2 = (endrow1 + 1)
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:= num, 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:=Cells(18, 9).Value, Collate:=True

'Reset print setup
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

End If


THANK YOU

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code is not working


Just in case anyone is curious:

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

'Do all except Vern


If CheckBox12.Value = True Then
fstyr = Range("FirstAll").Value
lstyr = Range("LastAll").Value

num = Cells(18, 9).Value

With Worksheets(Cells(18, 6).Value)

With .PageSetup
..Orientation = xlLandscape
..PaperSize = xlPaperLegal
..FitToPagesWide = 1
..FitToPagesTall = 1
End With

' for q 1 and q 2

startrow1 = 1
startcol1 = 20
endrow1 = 56 + 2 * (lstyr - fstyr)
endcol1 = 46

..Range(.Cells(startrow1, startcol1), .Cells(endrow1,
endcol1)).PrintOut Copies:=num, Collate:=True


' for q3 and q4
startcol2 = 20
startrow2 = (endrow1 + 1)
endrow2 = startrow2 + 42 + 2 * (lstyr - fstyr)
endcol2 = 46

..Range(.Cells(startrow2, startcol2), .Cells(endrow2,
endcol2)).PrintOut Copies:=num, Collate:=True

' for rest

startrow3 = 21
startcol3 = 48
endrow3 = 124
endcol3 = 59

..Range(.Cells(startrow3, startcol3), .Cells(endrow3,
endcol3)).PrintOut Copies:=num, Collate:=True

'Reset print setup
With ActiveSheet.PageSetup
..Orientation = xlLandscape
..PaperSize = xlPaperLetter
..FitToPagesWide = 1
..FitToPagesTall = 1
End With

End With

End If


--
Sheeny
------------------------------------------------------------------------
Sheeny's Profile: http://www.excelforum.com/member.php...fo&userid=9082
View this thread: http://www.excelforum.com/showthread...hreadid=555770

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
Pop up code not working Ian Manning Excel Programming 3 April 3rd 06 05:48 PM
Code not working GregR Excel Programming 9 July 26th 05 04:46 PM
Code not working and can't see why Steve Excel Discussion (Misc queries) 3 December 31st 04 03:12 PM
Code is not working....please take a look!!! tratliff[_12_] Excel Programming 5 August 24th 04 05:45 PM
For Each Code Not Working jacqui[_2_] Excel Programming 4 July 29th 03 02:44 AM


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