Ask Experts Questions for FREE Help !
Ask
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #1

    Sep 27, 2009, 11:26 AM
    Macro to print a page-or not, based on a cells content.
    Code:
    Sub Printing()
    '
    ' Printing Macro
    ' Macro recorded 15/12/2005 by Lenah
    '
    ' Keyboard Shortcut: Ctrl+p
    '
        Application.ScreenUpdating = False
        Sheets("Invoice").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=4, Collate:=True
        Sheets("SAD500").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
        
        'Print this sheet only if cell AX4=>2
        Sheets("SAD501-1").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
        
        'Print this sheet only if cell AX4=3
        Sheets("SAD501-2").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
        
        
        Sheets("Manhood").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True
        Sheets("Invoice").Select
        Application.ScreenUpdating = True
    End Sub

    Hope the code sample is sufficient.
    Thanks a mil.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #2

    Sep 27, 2009, 11:44 PM

    Try this:
    Code:
    Sub Printing()
    '
    ' Printing Macro
    ' Macro recorded 15/12/2005 by Lenah
    ' Edited by JBeaucaire  (27/9/2009)
    ' Keyboard Shortcut: Ctrl+p
    '
    Application.ScreenUpdating = False
        
    Sheets("Invoice").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=4, Collate:=True
        
    Sheets("SAD500").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
        
    'Print this sheet only if cell AX4=>2
    If Sheets("SAD501-1").Range("AX4") >= 2 Then
        Sheets("SAD501-1").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    End If
        
    'Print this sheet only if cell AX4=3
    If Sheets("SAD501-2").Range("AX4") = 3 Then
        Sheets("SAD501-2").Activate
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    End If
        
    Sheets("Manhood").Activate
    ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True
    Sheets("Invoice").Activate
    Application.ScreenUpdating = True
    End Sub
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #3

    Oct 1, 2009, 11:24 AM
    Works a treat, thank you very much.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Macro - select range based on cell data [ 4 Answers ]

I need a macro that will select a range based on a number in a cell. If the number in the cell (in this case the cell is K1) is 200 then I want to select Range A2:D201, if it was 100 then select Range A2:D101. Thanks for the help!

Macro to save a file name as per a cell content. [ 3 Answers ]

I have a macro saving the file auto. To my desktop. For example cell A1 = 501 I run a macro with a counter and auto. Changes A1 to 502. Now macro must change file saving to 502, or =cell A1 content. I also sometimes have to change destination from desktop to a specific file.

How to Print the content index of a folder [ 2 Answers ]

Can some one Help me, to copy the folder list/content like an index list. In any given folder on our computer we have different contents. They can be displayed as icons / thumbnails/ list or Details mode. In list mode we can see all the sub-folder and file names IN Details mode we can see...


View more questions Search