Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cells Flagged Not To Print (97:SR2)

    Is it possible to flag certain cells not to print. This would be similar to say a button object where once could flag it not to print.

    I'm not interested in changing the cell font to white.

    Thanks,
    John

  2. #2
    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: Cells Flagged Not To Print (97:SR2)

    Some suggestions, link to a formula which "hides" the cells in some way:

    white on white or black on black (other colors on other colors do NOT work well on black/white printers. this could be done using conditional formatting.

    uses a format such as (no quotes): ";;;" This could be added using a beforePrint macro that determines what cells not to print and changes the format. You would have to have a macro to return the formatting afterwards
    uses a formula with and IF to display the number of a null string:
    <pre>=if(A1=5, B5,"")</pre>


    You could base the formula on the linked cell of a checkbox, and when checked it would put in null string. This assumes that the VALUE in the cell is NOT used for anything, if it is, you could MOVE the cell elsewhere (outside the print range) and then base all the calcs on this cells as well as the Displayed formula.


    Steve

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Cells Flagged Not To Print (97:SR2)

    A BeforePrint macro which requires all such cells to be named "myrange" and the cells to not necessarily be contiguous would look like this, only better:

    Dim arrFormats() As String
    Dim rngCell As Range
    Dim intL As Integer
    ReDim arrFormats(Range("myrange").Cells.Count - 1)
    For Each rngCell In Range("myrange")
    arrFormats(intL) = rngCell.NumberFormat
    intL = intL + 1
    Next rngCell
    Range("myrange").NumberFormat = ";;;"
    ActiveSheet.PrintOut
    intL = 0
    For Each rngCell In Range("myrange")
    rngCell.NumberFormat = arrFormats(intL)
    intL = intL + 1
    Next rngCell
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    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: Cells Flagged Not To Print (97:SR2)

    That will ALMOSTwork.

    I think you will need to disableevents BEFORE the printout command otherwise you will TRIGGER the beforeprint event (again) WITHIN the beforeprint macro. Then enableevents again right after the printout.

    I also think you need to set cancel = true so after you macro is complete, it does NOT print. The beforeprint is triggered before it is printed and will call the print event after your macro is complete unless it is canceled.

    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
  •