+ Reply to Thread
Results 1 to 2 of 2

Set a print area to capture all data on a sheet

  1. #1
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Set a print area to capture all data on a sheet

    Hi,

    I have a problem which can be easily solved with VBA but as I have not yet attempted to learn VBA I am turning to the fountain of knowledge that is the Excel Forum.

    Basically I have a template spreadsheet and once I populate this with data I need to set a print area before printing. To automate this process I am looking to use some VBA.

    In column H a cell will show 'END OF FILE' below the last row of data. For the purpose of explaining lets say this happens to be in cell H101.
    I need VBA code to search column H to find this cell (I tried Cells.Find("END OF FILE") but that looks at the formulas not the actual value as I have found out). Once I know this I can then set the print range to ActiveSheet.PageSetup.PrintArea = "$F$1:$DH$100" but the '100' is a variable dependent on the location of END OF FILE (it will be the row number minus 1).

    Hopefully that made sense, if not I will sort out some mock data to help explain - let me know if this is required.

    Thanks in advance
    Harribone
    Say thanks, click *

  2. #2
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Set a print area to capture all data on a sheet

    Managed to figure it out eventually:

    Please Login or Register  to view this content.

+ 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. Macro - Set Print Area for Changing Data Area
    By ksp in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-27-2013, 04:19 AM
  2. Replies: 1
    Last Post: 02-12-2013, 12:16 PM
  3. Replies: 8
    Last Post: 05-23-2007, 06:39 AM
  4. [SOLVED] Pivot Table macro to set print area and print details of drill down data
    By Steve Haskins in forum Excel General
    Replies: 2
    Last Post: 12-28-2005, 01:10 PM
  5. Replies: 1
    Last Post: 11-24-2005, 07:29 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