Results 1 to 2 of 2

hide columns only when printing

This is a discussion on hide columns only when printing within the Excel Questions forums, part of the Question Forums category; Is there any way in excel to hide a column only when the report is being printed. In other words, ...

  1. #1
    Board Regular
    Join Date
    Aug 2003
    Posts
    137

    Default hide columns only when printing

    Is there any way in excel to hide a column only when the report is being printed. In other words, I have a couply of columns that I would like to keep on my report, but I don't want them to print. Do I have to manually hide each of these columns when I go to print the document?

  2. #2
    Board Regular LTunnicliffe's Avatar
    Join Date
    May 2003
    Location
    Round Rock, TX
    Posts
    767

    Default

    Try:

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    **
    **Cancel = True
    **Application.EnableEvents = False
    ****ActiveSheet.Columns(1).Hidden = True
    ****ActiveSheet.PrintOut
    ****ActiveSheet.Columns(1).Hidden = False
    **Application.EnableEvents = True
    **
    End Sub


    Specify the columns you want hidden where I have the Columns(1) line. Put this in the ThisWorkbook module of the VBE (ALT+F11). Let me know if you have problems.
    Loren

    The numbers don't lie, but sometimes they don't tell the whole truth.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com