+ Reply to Thread
Results 1 to 5 of 5

macro to print a specific range of cells

Hybrid View

  1. #1
    Registered User
    Join Date
    01-19-2005
    Posts
    2

    macro to print a specific range of cells

    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

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    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

  3. #3
    Registered User
    Join Date
    01-19-2005
    Posts
    2
    That worked.

    Thankyou very much anilsolipuram the help was greatly appreciated.

  4. #4
    Registered User
    Join Date
    05-03-2011
    Location
    Atlanta GA
    MS-Off Ver
    Excel 2000, 2007, 2010
    Posts
    1

    Re: macro to print a specific range of cells

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

  5. #5
    Registered User
    Join Date
    07-16-2018
    Location
    USA
    MS-Off Ver
    windows 10
    Posts
    5

    Re: macro to print a specific range of cells

    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.

+ 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