Results 1 to 9 of 9
  1. #1
    Lounger
    Join Date
    Aug 2005
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    custom printing with checkbox (2003)

    Hello Everyone,
    I need some help doing a macro or VB command to print only the selected columns. I am attaching a document that I would like to print. I would like to create a checkbox in column b2, b3 and forward that a user can check and base on that print only the columns selected. I would also like to hide the second row so the checkbox is not display when printing. Any help would be great. Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: custom printing with checkbox (2003)

    Do you really mean check boxes in B2, B3, etc., or did you actually mean B2, C2, D2 etc.?

  3. #3
    Lounger
    Join Date
    Aug 2005
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: custom printing with checkbox (2003)

    I would like a checkbox in each cell in row2 (ex: b2,b3,b4,b5,etc.) so they can select the column.My idea would be to print only the ones that are selected by the user. Thanks.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: custom printing with checkbox (2003)

    So many check boxes is a bit much. Why not simply let the user enter an "x" in the cells in row 2 in the columns to be printed? You could then use the following macro:

    Sub PrintSheet()
    Dim intCol As Integer
    Dim intLastCol As Integer
    With Worksheets("Sheet1")
    intLastCol = .Cells(1, 2).End(xlToRight).Column
    For intCol = 2 To intLastCol
    .Cells(1, intCol).EntireColumn.Hidden = Not (.Cells(2, intCol) = "x")
    Next intCol
    .Range("A2").EntireRow.Hidden = True
    .PrintOut ' or .PrintPreview
    .Range("A2").EntireRow.Hidden = False
    .Range(.Cells(1, 2), .Cells(1, intLastCol)).EntireColumn.Hidden = False
    End With
    End Sub

  5. #5
    Lounger
    Join Date
    Aug 2005
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: custom printing with checkbox (2003)

    Thanks Hans I will try that and see if it works.

  6. #6
    2 Star Lounger
    Join Date
    Oct 2005
    Location
    Cambridgeshire, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: custom printing with checkbox (2003)

    Hello Hans,
    I was trying to use the code above to do what aaaofpmch wanted to do, but if there is a gap in the rows where there is an x, the columns do not get hidden. Any ideas as to why? For example, if I select row 2 column a,b,c,d,u, etc. The columns between d and u do not hide and there is a big gap in between them. Any help would be great. Thanks

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: custom printing with checkbox (2003)

    Aren't you the same person as aaaofmpch?

    Try the attached version of your workbook. Click the button to preview only the selected columns.

  8. #8
    2 Star Lounger
    Join Date
    Oct 2005
    Location
    Cambridgeshire, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: custom printing with checkbox (2003)

    Yes I am. I don't have my password with me, so I ended up creating another account. By the way, I really want to thank you for all your help.

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: custom printing with checkbox (2003)

    Does the version I attached do what you want?

Posting Permissions

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