Macro to print a cell range

T

Tamsyn

I need to create a Macro to select a print area and then print. This range
will change as more data is added.
 
J

Jim Thomlinson

We need a lot more info to create a macro. Perhaps there is an easier way.
The print area for a worksheet is stored as a locally defined named range
called Print_Area. You can change the print area by changing the range
specified in this named range. Here is where it gets interesting. You can
change the print area dynamically by making the named range Dynamic. There is
an excellent explanation of dynamic named ranges on Chip Pearson's website
but the site is down at the moment... google for it later and you should be
able to find how it works...

So if you change Print_Area to something like

=Offset(A1, 0,0, counta(A:A), counta(1:1))
then the print range will adjust as more data is added...
 
D

Dave Peterson

This will print A1:X(lastusedrow of column A):

Option Explicit
Sub testme()
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("a1:x" & LastRow).PrintOut preview:=True
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