+ Reply to Thread
Results 1 to 3 of 3

Using VBA to Format sheet layouts for printing

Hybrid View

  1. #1
    Registered User
    Join Date
    03-08-2019
    Location
    Finland
    MS-Off Ver
    Office 365, 64-bit
    Posts
    2

    Question Using VBA to Format sheet layouts for printing

    Hi,
    So I am back to using Excel after 6 years and after appreciating the software the first thing I notice is the massive abuse of excel functionality by my colleagues (including me).
    I am using excel to print different documents like bill of materials and other similar lists. The excel sheets undergo editing regularly and that is where my OCD comes into play. Everyone takes the liberty of moving things. So when a document is ready for print it might not look like its previous versions. I want to standardize the final printing layout. Somethings that I would like to do is:
    to have fixed row and column heights
    fixed number of rows per page
    borders of same width around the pages
    rows to repeat at the top and bottom of the pages with correct page numbers added (maybe this can be done by making a dynamic header and footer)
    fixing margins and scaling etc.

    My idea is once the data inside the lists is ready, a click can format the sheets to the standard format for that particular document. Being not an expert on Excel and VBA I am not sure if this is possible. So my question is, whether this is possible and if yes can someone nudge me in the right direction?

    Searching Google didn't help me much except suggesting a few paid plugins; maybe the keywords I used in searching aren't correct. I would appreciate any kind of help as my OCD is killing me here.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Using VBA to Format sheet layouts for printing

    For something like that, you could try using the macro recorder to record the manual steps you take in page set up mode tp add headers, footers, page breaks and print areas . Once you have your basic code, you could then start a thread to get help modifying the code to streamline it and get it to do what you want. VBA can handle what you describe, but the details have to be supplied by the user to develop code.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    03-08-2019
    Location
    Finland
    MS-Off Ver
    Office 365, 64-bit
    Posts
    2

    Re: Using VBA to Format sheet layouts for printing

    Thanks for the reply, that is a good idea.
    I was also looking at other options. One that I like is to use templates so there does not need to be any dynamic code. I made a default template with a 100 pages (I inserted the rows at the top and bottom manually with the document meta data as
    #project_no
    or
    page number 1 of #total_pages
    . These should be easy to edit using the find and replace tool. Now I need to check on how to populate the template. The challenge would be to import the rows from the original sheet but divide them into a set of 30 rows so they can be put in the template pages in the correct place. Will see how that goes.

+ 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: 1
    Last Post: 11-15-2019, 02:57 AM
  2. Designing Layouts, Creating and printing reports
    By BILL EVAUL in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-15-2018, 04:34 AM
  3. Printing output using format from another sheet in the same workbook
    By Tapyr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2014, 06:53 AM
  4. Replies: 2
    Last Post: 05-27-2014, 03:02 PM
  5. How to have 2 Different Printing Layouts for a 2 page macro print job (paper/PDF)
    By bobby.bobby in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2013, 04:06 AM
  6. Replies: 0
    Last Post: 07-18-2012, 03:57 AM
  7. Disabling Printing ability of a sheet unless printing from a macro
    By cadamhill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2012, 04:41 AM

Tags for this Thread

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