setting up the print area

G

Gina

Hi,

I have a set of data that has been exported from Access into an Excel sheet.
The data has a fixed column width from A to AO, in row 24 going down. The
number of rows of data is not fixed.

What I want to do is automate setting the print area which will include all
the visible data when a button is clicked. I'm finding this hard because
there are a number of columns within the A:AO range that will be hidden, but
not always the same ones.

I also want the print area to incude the visible blank cells from the
("A1:AO24") range above this data - but not the blank rows below the last row
of data.

Also the AP column, to the right of the data contains text that i don't want
to include in the print area.

Can anyone help?

Thanks
 
T

Tom Ogilvy

Dim lastRow as Long
lastrow = cells(rows.count,1).End(xlup).row

Activesheet.PageSetup.PrintArea = "'" & Activesheet.Name & _
"'!$A$1:$AO$" & lastrow
 

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

Similar Threads


Top