Setting printarea through range object

  • Thread starter Thread starter Berend Botje
  • Start date Start date
B

Berend Botje

Hi,

I have a worksheet in which I have hidden all of the empty rows. Now
want to print the visible rows, but I don't seem to be able to.

I prefer selecting the rows and storing them in a range object, afte
which I can set the range object as the printarea. Can this be done an
if so, what code should I use?

Yours truly,

Berend Botj
 
Hi Berend.
I have a worksheet in which I have hidden all of the empty rows. Now I
want to print the visible rows, but I don't seem to be able to.

Hidden rows do *not* print so you should have no problem.
I prefer selecting the rows and storing them in a range object, after
which I can set the range object as the printarea. Can this be done and
if so, what code should I use?

Certainly. For example:

Sub SetPrintArea()
Dim Rng As Range
' Set your range to suit
Set Rng = Range("A1:H3,A24:H25")
ActiveSheet.PageSetup.PrintArea = Rng.Address
End Sub
 
First of all, thanks for reacting.

Can I do the range thing with R1C1 coordinates? I can't get it to wor
properly with multiple range selections. For example I want to selec
columns 1 through AK of rows 1 through 200 and 250 through 400. How ca
I do this
 
Setting a multirange printarea will result in multiple print jobs. Since
you are hiding the rows you don't want to print, you should set the print
area to one contiguous range and hide the rows you don't want printed --
unless you want multiple print jobs.
 
I found the problem.... I want to print the first 8 rows on every page
That is why all rows (including the hidden ones) are printed. Since
have over 10000 rows, this is most unwanted. Does anyone know how t
solve this
 
I couldn't reproduce that using Rows to Repeat at top. If I had hidden rows
in the specified rows, they were not printed.
 
I've never seen hidden rows print.

But if I added manual page breaks, I could see the rows to repeat at top show up
for those pages that have nothing but hidden rows.

I'd either remove the manual page breaks or copy the worksheet and delete the
hidden rows (and print from there).
 

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


Back
Top