custom printing

D

DCFassett

In Excel I have a large spreadsheet that I need to have several different
views printed. I have set up the command buttons to hide appropriate columns
and set length to only the amount of data entered for rows. My problem begins
when I hide the columns. They do not hide in the way intended. Also the
VPageBreaks will not actually move over to where I want them making the data
display broken across several pages instead of one.

Could someone please check my code and see if there is something wrong with
it. No errors show up anywhere except execution.

Would appreciate any help at all.

Here is the code (E11 is valued at the last row number of data)

PrintAPFT Macro
' Macro recorded 9/9/2007 by derek.fassett
'
ActiveSheet.Unprotect Password:="***"
Columns("D:E").Select
Selection.EntireColumn.Hidden = True
Columns("G:G").Select
Selection.EntireColumn.Hidden = True
Columns("J:AG").Select
Selection.EntireColumn.Hidden = True
Columns("AI:AJ").Select
Selection.EntireColumn.Hidden = True
Range("A16:BD" & Range("E11").Value).Select
ActiveSheet.PageSetup.PrintArea = "$A$16:$BD$" & Range("E11").Value
ActiveSheet.VPageBreaks(1).Location = Worksheets(1).Range("bd1")
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
ActiveSheet.PageSetup.PrintArea = ""
Cells.Select
Range("A16").Activate
Selection.EntireColumn.Hidden = False
Range("A16").Select
ActiveSheet.Protect Password:="***", _
DrawingObjects:=True, Contents:=True, Scenarios:=True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top