Code for printing pages

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,602
Office Version
  1. 365
Platform
  1. Windows
Hi all,

On my worksheet range A1:K4 are used as my sheet 'headers'
rows 4:70 are then used to place data

I want to change the simple code I have that prints all the data.

I want the headers in range A1:K4 to be shown at the top of each page printed.

for example

Page 1 will print the headers on range A1:K4 then all the data on rows 5:19
Page 2 will print the headers on range A1:K4 then all the data on rows 20:35
Page 3 will print the headers on range A1:K4 then all the data on rows 36:51
etc etc

Obviously I only want the above 'pages' to be printed if there is data on them

is this possible??

thanks in advance
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
this is simple.

open the help function in excel, and search for "print header"

the first item will be the one you need.

Row headings are the row numbers to the left of the worksheet; column headings are the letters or numbers that appear at the top of the columns on a worksheet.
  1. Click the worksheet.
  2. On the File menu, click Page Setup, and then click the Sheet tab.
  3. Do one of the following: Print row and column headings
    • Select the Row and column headings check box, and click Print.
    Print row and column labels on every page
    • To print column labels on every page, under Print titles in the Rows to repeat at top box, enter the rows that contain the column labels, and then click Print.
    • To print row labels on every page, under Print titles in the Columns to repeat at left box, enter the columns that contain the row labels, and then click Print.

then open print preview, and click page break preview at the top, then you can adjust the blue bars to your print areas. to get back to a normal view, just go to print preview again and press normal view.


EDIT:
if you want the VBA code for this, then start recording a macro and then do the above, once finished just stop recording. that way it will create the code for you, and you can just paste it into your current macro, and it will be repeatable whenever you want.
 
Last edited:
Upvote 0
..not too sure if I follow that - but I'll have a go

One other point, how do I make sure that only the populated 'pages' are printed??
 
Upvote 0

Forum statistics

Threads
1,214,885
Messages
6,122,085
Members
449,064
Latest member
MattDRT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top