Adjust the print range of a list

P

pja

I import data (names etc) using a macro. The macro makes a kind o
signature-list, layout with borderlines etc.
Sometimes the data contains 10 names and sometimes 200 names.

If the list only contains 10 names and I want to print, the first pag
contains de 10 names the rest of the pages are filled with only th
layout (created for the max. of 200 names)

Is it possible that the area of printing is set automaticall
containing the last name when the next cell in the column is empty ?
The names are in the first column.

Thnx

PJ
 
F

Frank Kabel

Hi
try a macro like the following:
Sub print_rows()
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
wirh ActiveSheet
.PageSetup.PrintArea = "$A$1:$A$" & LastRow
.PrintOut
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top