+ Reply to Thread
Results 1 to 3 of 3

Can I use Print in an if formula?

  1. #1
    CC
    Guest

    Can I use Print in an if formula?

    Hope someone can help.
    I have a workbook with quite a few sheets. Is it possible to write an if
    formula where, if a certain cell on the sheet >0, the whole sheet should be
    printed?
    Can I then write a macro where it tests all the sheets in the workbook?

  2. #2
    Arvi Laanemets
    Guest

    Re: Can I use Print in an if formula?

    Hi

    Formulas/Functions can't invoke any activities, you must use a
    procedure/macro for it.

    --
    When sending mail, use address arvil<at>tarkon.ee
    Arvi Laanemets


    "CC" <[email protected]> wrote in message
    news:[email protected]...
    > Hope someone can help.
    > I have a workbook with quite a few sheets. Is it possible to write an if
    > formula where, if a certain cell on the sheet >0, the whole sheet should

    be
    > printed?
    > Can I then write a macro where it tests all the sheets in the workbook?




  3. #3
    JulieD
    Guest

    Re: Can I use Print in an if formula?

    Hi

    you can't use a formula for this, but you can use a macro to cycle through
    all the worksheets testing the value of a cell and then printing that sheet,
    e.g.

    Sub cyclethroughws()
    Dim ws As Worksheet
    For Each ws In Worksheets
    If ws.Range("A1").Value > 0 Then 'change the cell reference as
    needed.
    ws.PrintOut
    MsgBox "printed " & ws.Name
    End If
    Next ws
    End Sub

    ---

    to use this code, right mouse click on a sheet tab and choose view code
    from the menu choose insert / module
    copy & paste the code onto the right hand side of the screen
    if any lines go red, click and the end of the line and press the delete
    key - this should fix line wrap problems
    then use ALT & F11 to switch back to your workbook
    choose tools / macro / macros - look for the one that says
    "cyclethroughws" and press the RUN button

    Hope this helps
    Cheers
    JulieD

    "CC" <[email protected]> wrote in message
    news:[email protected]...
    > Hope someone can help.
    > I have a workbook with quite a few sheets. Is it possible to write an if
    > formula where, if a certain cell on the sheet >0, the whole sheet should
    > be
    > printed?
    > Can I then write a macro where it tests all the sheets in the workbook?




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1