View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Setting printarea through range object

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

---
Regards,
Norman