Creating Macro to print selected cellsHow can I export a generic page range to PDF using Microsoft Office...

How should I respond when I lied about my education and the company finds out through background check?

Query about absorption line spectra

Drawing ramified coverings with tikz

Gibbs free energy in standard state vs. equilibrium

Proving a function is onto where f(x)=|x|.

Is it improper etiquette to ask your opponent what his/her rating is before the game?

Some numbers are more equivalent than others

What major Native American tribes were around Santa Fe during the late 1850s?

Is camera lens focus an exact point or a range?

Greatest common substring

Can a significant change in incentives void an employment contract?

What is the gram­mat­i­cal term for “‑ed” words like these?

Folder comparison

Difference between -| and |- in TikZ

What's the difference between 違法 and 不法?

Is XSS in canonical link possible?

Proof of Lemma: Every nonzero integer can be written as a product of primes

Two-sided logarithm inequality

Drawing a topological "handle" with Tikz

Open a doc from terminal, but not by its name

Find last 3 digits of this monster number

Why is Arduino resetting while driving motors?

How do ground effect vehicles perform turns?

Can somebody explain Brexit in a few child-proof sentences?



Creating Macro to print selected cells


How can I export a generic page range to PDF using Microsoft Office *without* a PDF printer?MS Excel 2007 Warning Significant loss of functionalitySort with a MacroHow to import several worksheets from a single Excel file to Microsoft Word document as linked and updateable objects?Return to selected page after macro runsExcel 2015 Macro/Equation Copy Specific Data from one worksheet to anotherExcel - vlookup for multiple to return value from multiple csv filesHow do you use COUNTIF function to compare a column of text to a date?Moving selected cell data in excel right or left without using cut + paste or, copy and paste. Move data with arrow keys would be greatHow can I clear Active Row using VBA?













0















I am trying to record a Macro to print selected cells then return the worksheet to its original format. I am hiding columns B through H, printing A7:I68. While recording the Macro the print comes out correct. Once saved it only prints column A7:A68, does not include column I.



ActiveSheet.Unprotect
Columns("B:H").Select
Selection.EntireColumn.Hidden = True
Range("A7:I68").Select
ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68"
Selection.PrintOut Copies:=1, Collate:=True
Columns("A:I").Select
Selection.EntireColumn.Hidden = False
ActiveWindow.SmallScroll Down:=-72
Range("A10").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False


Any Suggestions?










share|improve this question
















bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Edit the question and insert your Macro

    – yass
    Mar 30 '17 at 16:49











  • Go into the macro, and press F8. See what happens, and press F8 and see what happens, step by step. Maybe it's not hiding the columns properly. Maybe it's not selecting the print area - stepping into a macro is a decent troubleshooting step.

    – Selkie
    Mar 30 '17 at 19:57











  • Selkie, Thank you for your suggestion, I tried it but got the same result. The print area is set up correct in the macro but the output is still only column A. ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68". Any other ideas?

    – Tina Stone
    Mar 31 '17 at 13:24
















0















I am trying to record a Macro to print selected cells then return the worksheet to its original format. I am hiding columns B through H, printing A7:I68. While recording the Macro the print comes out correct. Once saved it only prints column A7:A68, does not include column I.



ActiveSheet.Unprotect
Columns("B:H").Select
Selection.EntireColumn.Hidden = True
Range("A7:I68").Select
ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68"
Selection.PrintOut Copies:=1, Collate:=True
Columns("A:I").Select
Selection.EntireColumn.Hidden = False
ActiveWindow.SmallScroll Down:=-72
Range("A10").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False


Any Suggestions?










share|improve this question
















bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Edit the question and insert your Macro

    – yass
    Mar 30 '17 at 16:49











  • Go into the macro, and press F8. See what happens, and press F8 and see what happens, step by step. Maybe it's not hiding the columns properly. Maybe it's not selecting the print area - stepping into a macro is a decent troubleshooting step.

    – Selkie
    Mar 30 '17 at 19:57











  • Selkie, Thank you for your suggestion, I tried it but got the same result. The print area is set up correct in the macro but the output is still only column A. ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68". Any other ideas?

    – Tina Stone
    Mar 31 '17 at 13:24














0












0








0








I am trying to record a Macro to print selected cells then return the worksheet to its original format. I am hiding columns B through H, printing A7:I68. While recording the Macro the print comes out correct. Once saved it only prints column A7:A68, does not include column I.



ActiveSheet.Unprotect
Columns("B:H").Select
Selection.EntireColumn.Hidden = True
Range("A7:I68").Select
ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68"
Selection.PrintOut Copies:=1, Collate:=True
Columns("A:I").Select
Selection.EntireColumn.Hidden = False
ActiveWindow.SmallScroll Down:=-72
Range("A10").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False


Any Suggestions?










share|improve this question
















I am trying to record a Macro to print selected cells then return the worksheet to its original format. I am hiding columns B through H, printing A7:I68. While recording the Macro the print comes out correct. Once saved it only prints column A7:A68, does not include column I.



ActiveSheet.Unprotect
Columns("B:H").Select
Selection.EntireColumn.Hidden = True
Range("A7:I68").Select
ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68"
Selection.PrintOut Copies:=1, Collate:=True
Columns("A:I").Select
Selection.EntireColumn.Hidden = False
ActiveWindow.SmallScroll Down:=-72
Range("A10").Select
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False


Any Suggestions?







microsoft-excel macros






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 30 '17 at 17:09







Tina Stone

















asked Mar 30 '17 at 16:35









Tina StoneTina Stone

13




13





bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Edit the question and insert your Macro

    – yass
    Mar 30 '17 at 16:49











  • Go into the macro, and press F8. See what happens, and press F8 and see what happens, step by step. Maybe it's not hiding the columns properly. Maybe it's not selecting the print area - stepping into a macro is a decent troubleshooting step.

    – Selkie
    Mar 30 '17 at 19:57











  • Selkie, Thank you for your suggestion, I tried it but got the same result. The print area is set up correct in the macro but the output is still only column A. ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68". Any other ideas?

    – Tina Stone
    Mar 31 '17 at 13:24



















  • Edit the question and insert your Macro

    – yass
    Mar 30 '17 at 16:49











  • Go into the macro, and press F8. See what happens, and press F8 and see what happens, step by step. Maybe it's not hiding the columns properly. Maybe it's not selecting the print area - stepping into a macro is a decent troubleshooting step.

    – Selkie
    Mar 30 '17 at 19:57











  • Selkie, Thank you for your suggestion, I tried it but got the same result. The print area is set up correct in the macro but the output is still only column A. ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68". Any other ideas?

    – Tina Stone
    Mar 31 '17 at 13:24

















Edit the question and insert your Macro

– yass
Mar 30 '17 at 16:49





Edit the question and insert your Macro

– yass
Mar 30 '17 at 16:49













Go into the macro, and press F8. See what happens, and press F8 and see what happens, step by step. Maybe it's not hiding the columns properly. Maybe it's not selecting the print area - stepping into a macro is a decent troubleshooting step.

– Selkie
Mar 30 '17 at 19:57





Go into the macro, and press F8. See what happens, and press F8 and see what happens, step by step. Maybe it's not hiding the columns properly. Maybe it's not selecting the print area - stepping into a macro is a decent troubleshooting step.

– Selkie
Mar 30 '17 at 19:57













Selkie, Thank you for your suggestion, I tried it but got the same result. The print area is set up correct in the macro but the output is still only column A. ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68". Any other ideas?

– Tina Stone
Mar 31 '17 at 13:24





Selkie, Thank you for your suggestion, I tried it but got the same result. The print area is set up correct in the macro but the output is still only column A. ActiveSheet.PageSetup.PrintArea = "$A$7:$I$68". Any other ideas?

– Tina Stone
Mar 31 '17 at 13:24










1 Answer
1






active

oldest

votes


















0














Tina I would like to suggest VBA code to print Not one but Multiple Selections,, this will copy range to print make sheet paste there, show Preview, Print & finally delete that sheet.



Sub Print_MultiSelection()

Dim rng As Range, ws As Worksheet, rngArea As Range

Set rng = Selection

Set ws = Worksheets.Add(After:=Sheets(Sheets.Count))

For Each rngArea In rng.Areas rngArea.Copy Destination:=ws.Range(rngArea.Address)

ws.Range(rngArea.Address).Value = rngArea.Value

Next

rngArea ws.PrintPreview

ws.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:= False

Application.DisplayAlerts = False

ws.Delete Application.DisplayAlerts = True

rng.Parent.Activate

End Sub





share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1193978%2fcreating-macro-to-print-selected-cells%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Tina I would like to suggest VBA code to print Not one but Multiple Selections,, this will copy range to print make sheet paste there, show Preview, Print & finally delete that sheet.



    Sub Print_MultiSelection()

    Dim rng As Range, ws As Worksheet, rngArea As Range

    Set rng = Selection

    Set ws = Worksheets.Add(After:=Sheets(Sheets.Count))

    For Each rngArea In rng.Areas rngArea.Copy Destination:=ws.Range(rngArea.Address)

    ws.Range(rngArea.Address).Value = rngArea.Value

    Next

    rngArea ws.PrintPreview

    ws.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:= False

    Application.DisplayAlerts = False

    ws.Delete Application.DisplayAlerts = True

    rng.Parent.Activate

    End Sub





    share|improve this answer






























      0














      Tina I would like to suggest VBA code to print Not one but Multiple Selections,, this will copy range to print make sheet paste there, show Preview, Print & finally delete that sheet.



      Sub Print_MultiSelection()

      Dim rng As Range, ws As Worksheet, rngArea As Range

      Set rng = Selection

      Set ws = Worksheets.Add(After:=Sheets(Sheets.Count))

      For Each rngArea In rng.Areas rngArea.Copy Destination:=ws.Range(rngArea.Address)

      ws.Range(rngArea.Address).Value = rngArea.Value

      Next

      rngArea ws.PrintPreview

      ws.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:= False

      Application.DisplayAlerts = False

      ws.Delete Application.DisplayAlerts = True

      rng.Parent.Activate

      End Sub





      share|improve this answer




























        0












        0








        0







        Tina I would like to suggest VBA code to print Not one but Multiple Selections,, this will copy range to print make sheet paste there, show Preview, Print & finally delete that sheet.



        Sub Print_MultiSelection()

        Dim rng As Range, ws As Worksheet, rngArea As Range

        Set rng = Selection

        Set ws = Worksheets.Add(After:=Sheets(Sheets.Count))

        For Each rngArea In rng.Areas rngArea.Copy Destination:=ws.Range(rngArea.Address)

        ws.Range(rngArea.Address).Value = rngArea.Value

        Next

        rngArea ws.PrintPreview

        ws.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:= False

        Application.DisplayAlerts = False

        ws.Delete Application.DisplayAlerts = True

        rng.Parent.Activate

        End Sub





        share|improve this answer















        Tina I would like to suggest VBA code to print Not one but Multiple Selections,, this will copy range to print make sheet paste there, show Preview, Print & finally delete that sheet.



        Sub Print_MultiSelection()

        Dim rng As Range, ws As Worksheet, rngArea As Range

        Set rng = Selection

        Set ws = Worksheets.Add(After:=Sheets(Sheets.Count))

        For Each rngArea In rng.Areas rngArea.Copy Destination:=ws.Range(rngArea.Address)

        ws.Range(rngArea.Address).Value = rngArea.Value

        Next

        rngArea ws.PrintPreview

        ws.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:= False

        Application.DisplayAlerts = False

        ws.Delete Application.DisplayAlerts = True

        rng.Parent.Activate

        End Sub






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 4 '18 at 10:59


























        community wiki





        2 revs
        Rajesh S































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1193978%2fcreating-macro-to-print-selected-cells%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

            Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

            looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...