# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  macro to print a specific range of cells

## shortnewb

I have the following:

Worksheet1: where the button and links are from
Worksheet2: where the button kicks off the macro and also links to certain parts of

Problem:

I'm trying to get the macro to only print a range but it prints the entire page. Even if I edit the macro myself I fail to change this. Here is the macro

Sheet("Worksheet2").Select
    Range("A2:F15").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
    Sheets("Fortnightly Checklist").Select
End Sub

Range ("A2:F15") is the range I want to print. I actually named that range earlier when I created the link to it, but the macro doesn't like it (name of the range is gravel).

Could someone give me an updated macro that would at least allow me to print only selected ranges?

Thanks
Shortnewb

----------


## anilsolipuram

You have to use "set print area"

Sheet("Worksheet2").Select
Range("A2:F15").Select
    ActiveSheet.PageSetup.PrintArea = "A2:F15"
    ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate _
        :=True

----------


## shortnewb

That worked.

Thankyou very much anilsolipuram the help was greatly appreciated.

----------


## margaretrose711

What a huge relief - that worked perfectly!!!  Thanks so much!!

----------


## softedges

I would like to exclude certain columns in between ranges to print.
Example print columns A to N, exclude printing columns G,H,K,L.

----------

