Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Set Printable area to skip columns

I'm working on a spreadsheet, where the printable area needs to skip columns
K through Columns AQ (yes, the spreadsheet is that wide.) Basically when
printed, I need it to appear that those columns have been hidden, and only
print A through J, then on the same page, AR through AS. Since this is being
set up for other users, asking them to hide, print, then unhide is not really
feasible. I saw one macro that claimed it would work, but unfortunately, it
didn't. It would also be nice if the "Print Preview" showed the exact same
thing as what was going to print.

This is that macro, edited for my needs of course.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Range("K1,AQ1").EntireColumn.Hidden = True
.PrintOut
.Range("K1,AQ1").EntireColumn.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub

Any ideas?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Set Printable area to skip columns

Found my own answer. I'm so smart (heh, yeah right)

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Range("K:AQ").EntireColumn.Hidden = True
.PrintOut
.Range("K:AQ").EntireColumn.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub


"slinger" wrote:

I'm working on a spreadsheet, where the printable area needs to skip columns
K through Columns AQ (yes, the spreadsheet is that wide.) Basically when
printed, I need it to appear that those columns have been hidden, and only
print A through J, then on the same page, AR through AS. Since this is being
set up for other users, asking them to hide, print, then unhide is not really
feasible. I saw one macro that claimed it would work, but unfortunately, it
didn't. It would also be nice if the "Print Preview" showed the exact same
thing as what was going to print.

This is that macro, edited for my needs of course.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Range("K1,AQ1").EntireColumn.Hidden = True
.PrintOut
.Range("K1,AQ1").EntireColumn.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub

Any ideas?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Set Printable area to skip columns

My opinion only...

I would give the users a dedicated macro (a button from the forms toolbar placed
on that worksheet???) that did exactly what I wanted it to.

Then the user could choose to print normally (someday they may want/need to!) or
click the button and do what I want them to do.

The macro would hide the columns, print the worksheet and unhide those columns.

But you may want to try:

..Range("K1:AQ1")
instead of:
..Range("K1,AQ1")
(both spots)

Be aware that the user can print Sheet1 without it being the activesheet.
That's one of the reasons that I like the dedicated macro.

slinger wrote:

I'm working on a spreadsheet, where the printable area needs to skip columns
K through Columns AQ (yes, the spreadsheet is that wide.) Basically when
printed, I need it to appear that those columns have been hidden, and only
print A through J, then on the same page, AR through AS. Since this is being
set up for other users, asking them to hide, print, then unhide is not really
feasible. I saw one macro that claimed it would work, but unfortunately, it
didn't. It would also be nice if the "Print Preview" showed the exact same
thing as what was going to print.

This is that macro, edited for my needs of course.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Range("K1,AQ1").EntireColumn.Hidden = True
.PrintOut
.Range("K1,AQ1").EntireColumn.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub

Any ideas?


--

Dave Peterson
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
Skip blank columns with LOOKUP formula HuskerBronco Excel Worksheet Functions 7 August 23rd 06 07:06 AM
number columns skip blanks wsk Excel Discussion (Misc queries) 4 May 11th 06 03:07 PM
Skip columns from XIRR function Bedazelled Excel Discussion (Misc queries) 0 April 26th 06 08:12 AM
Columns FemIce Excel Discussion (Misc queries) 1 September 28th 05 09:29 AM
Skip some columns when creating a chart MikeJ Charts and Charting in Excel 3 April 15th 05 12:15 AM


All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"