Eliminating blank columns when printing

  • Thread starter Thread starter IvanSaint
  • Start date Start date
I

IvanSaint

Hi, folks:

I'm not sure if Excel can do this or not. I have information entered i
columns that have blank columns in between. When I print, I want th
blank columns eliminated - but I want them to stay in place when I'
not printing. I want an automatic process that eliminates them(or, a
automatic as possible). More simply put, if I have data in columns A
C, and E, and columns A, and D are blank, when I print, I want th
information in columns A, C, and E to be in columns A, B, and C. An
advice you folks can give me is appreciated
 
Try this

This event in the thisworkbook module
I use a a example a sheet with the name "Sheet1"

The event will run if you press the print button or use Ctrl-P

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Range("B:B,D:D").EntireColumn.Hidden = True
.PrintPreview
.Range("B:B,D:D").EntireColumn.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub

More information on this page
http://www.rondebruin.nl/print.htm#Hide
 
Change PrintPreview to PrintOut

--
Regards Ron de Bruin
http://www.rondebruin.nl


Ron de Bruin said:
Try this

This event in the thisworkbook module
I use a a example a sheet with the name "Sheet1"

The event will run if you press the print button or use Ctrl-P

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Range("B:B,D:D").EntireColumn.Hidden = True
.PrintPreview
.Range("B:B,D:D").EntireColumn.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub

More information on this page
http://www.rondebruin.nl/print.htm#Hide
 
Back
Top