locked
create a formula to print RRS feed

  • Question

  • i have sheet1 with orders.

    i have sheet2 with the PO page

    sheet2 vlookups information from sheet1 then i can print the page.

    is there a way to put a formula in sheet1 to print sheet2 w/o me having to go to sheet2 and click print?

    Thursday, September 16, 2010 5:53 PM

Answers

  • Formulas do not execute commands they only return values to the cell where they are located.

    What you need is a macro.  However, there is too little data for use to write it for you, so here is the general idea:

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim isect As Range
        Set isect = Application.Intersect(Target, Range("B2:B100"))
        If Not isect Is Nothing Then
            'Your code here
        End If
    End Sub

    1. To add this code to your file, press Alt+F11, 
    2.  In the VBAProject window, top left side, find your sheet name under your file name and double click it.
    3.  Paste in or type the code above.

    You could record the print settings and print command and put that code into the section marked 'Your code here


    If this answer solves your problem, please check Mark as Answered. If this answer helps, please click the Vote as Helpful button. Cheers, Shane Devenshire
    • Marked as answer by Sally Tang Friday, September 24, 2010 4:46 AM
    Saturday, September 18, 2010 11:20 PM

All replies

  • Hi,

    There's no formula that I know of but you could create a macro to do if for you.

    Go to the Developer tab (I am assuming you have Excel 2007), and in the Code group you'll find 'Record Macro'.  Once you have got yourself ready and are ready to start the process, click on this button, and go through the steps starting with Printing page 1, then once that it done, select sheet 2 and do the same.  Once everything is done click on 'Stop Marco' and there you have it.  Now you can assign a shortcut to this and even a name and now you can even create a button on Sheet 1.  To create a button: on the Developer tab, go to the 'Controls' group and click on the 'Insert' button and select the first option 'Button(Form Control' then create this on sheet 1 by using the guidelines to create a box/button, assign the macro you just created to it, re-name it 'Printing' or whatever and when clicked it should do all the steps you just did when you printed out the 2 pages.

    Give it a try.  Cheers

    • Proposed as answer by kiwiangus Friday, September 17, 2010 4:29 PM
    Friday, September 17, 2010 4:29 PM
  • Formulas do not execute commands they only return values to the cell where they are located.

    What you need is a macro.  However, there is too little data for use to write it for you, so here is the general idea:

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim isect As Range
        Set isect = Application.Intersect(Target, Range("B2:B100"))
        If Not isect Is Nothing Then
            'Your code here
        End If
    End Sub

    1. To add this code to your file, press Alt+F11, 
    2.  In the VBAProject window, top left side, find your sheet name under your file name and double click it.
    3.  Paste in or type the code above.

    You could record the print settings and print command and put that code into the section marked 'Your code here


    If this answer solves your problem, please check Mark as Answered. If this answer helps, please click the Vote as Helpful button. Cheers, Shane Devenshire
    • Marked as answer by Sally Tang Friday, September 24, 2010 4:46 AM
    Saturday, September 18, 2010 11:20 PM