Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Select Colums to print (Excel 2002)

    Hi

    Is possible to design a
    If you are a fool at forty, you will always be a fool

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

    Re: Select Colums to print (Excel 2002)

    You can simply hide the columns you don't want to print, and unhide them after printing.
    Or use a list of columns, with an "x" if you want to print, and a command button. See attached version.

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Select Colums to print (Excel 2002)

    Hi Hans

    Thanks very much that's just what I am looking for.

    Hope you have a good Yuletide.

    Braddy
    If you are a fool at forty, you will always be a fool

  4. #4
    Silver Lounger t8ntlikly's Avatar
    Join Date
    Dec 2001
    Location
    Chandler, AZ
    Posts
    2,162
    Thanks
    46
    Thanked 13 Times in 11 Posts

    Re: Select Colums to print (Excel 2002)

    Hans,
    Would you mind explaining that command button that you did there please. How does that work?
    Thanks John
    Teamwork is essential; it gives the enemy other people to shoot at. (Murphy's War Laws #39)

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Select Colums to print (Excel 2002)

    Hans is not online right now and I will try to answer for him.

    The command button calls the procedure "PrintSelected"
    This macro is in Module 1:

    <pre> Dim i As Integer</pre>


    Dimensions a variable as an interger. This will be used to indicate what column will be hidden

    There are 6 columns to work on they are columns I:N (col numbers 9-14). The indications for hiding those columns are in cells B48:B53, respectively.
    This line loops through the 6 columns

    <pre> For i = 1 To 6 ' number of products</pre>


    This line hides/unhides the column based on whether the item in Col B of hte approriate row has an "x" or not. (for I = 1, col 9 is set by B48, for i=2, col 2 is set by B49, etc)

    <pre> ActiveSheet.Columns(i + 8).Hidden = _
    Not LCase(ActiveSheet.Range("B" & (i + 47))) = "x"</pre>


    This marks the end of the loop. When the code gets here it goes to the FOR statement
    <pre> Next i</pre>


    The following line goes to print preview mode (for testing) and indicates to comment/uncomment after testing to set the code to really print
    <pre> ' comment out next line after testing
    ActiveSheet.PrintPreview
    ' uncomment next line after testing
    'ActiveSheet.Printout</pre>


    The following unhides all the columns
    <pre> ActiveSheet.Range("I:N").EntireColumn.Hidden = False</pre>


    I hope this answers your question. If you have more specific questions, please post back.

    Steve

Posting Permissions

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