+ Reply to Thread
Results 1 to 3 of 3

Printing data in a changing range

Hybrid View

4lowie Printing data in a changing... 07-27-2015, 07:58 PM
quekbc Re: Printing data in a... 07-27-2015, 09:27 PM
alansidman Re: Printing data in a... 07-27-2015, 09:27 PM
  1. #1
    Forum Contributor
    Join Date
    12-08-2013
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2010
    Posts
    117

    Printing data in a changing range

    HI all

    I need to create a macro that prints columns A:S down to the last active cell in column A.

    There may be data further down the sheet or across the sheet but I need the cut off point to be the last cell with data in column A.

    Idea's please?

    Thanks Dave

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Printing data in a changing range

    Are you looking for something like this?
    Sub SetPrintArea()
    Dim l As Long
        l = Range("A1").EntireColumn.Find("*", Range("A1"), , , , xlPrevious).Row
    
        With ActiveSheet
            .PageSetup.PrintArea = Range("A1:S" & CStr(l)).Address
            .PrintPreview
        End With
            
    End Sub

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,771

    Re: Printing data in a changing range

    Try this:

    Sub PrintRange()
        Dim FinalRow As Long
    
        FinalRow = Cells(Rows.Count, "A").End(xlUp).Row
        ActiveSheet.PageSetup.PrintArea = "A1:S" & FinalRow
        ActiveSheet.PrintPreview
    End Sub
    Last edited by alansidman; 07-27-2015 at 09:32 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 15
    Last Post: 12-22-2014, 08:03 AM
  2. Help! Cell Data Changing When Printing?!
    By jaideb in forum Excel General
    Replies: 1
    Last Post: 11-20-2014, 01:01 PM
  3. Change the line graph range in Excel 2007 automatically without changing the data range
    By vinuhm@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2013, 05:26 AM
  4. How do you loop through a range of data printing after each row?
    By LeanRopp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2010, 06:49 PM
  5. Changing VBA code to return data range, appending to prior data
    By camcrazy08 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2007, 10:53 AM
  6. printing only active range (changing)
    By oz_saar in forum Excel General
    Replies: 2
    Last Post: 08-02-2005, 04:05 PM
  7. Printing a range of data from worksheets
    By stge in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2005, 03:02 AM

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