View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Set Print Area Macro

Hi
try something like the following:
sub foo()
dim rng as range
with activesheet
set rng=selection
.PageSetup.PrintArea = rng.address
.printout
end with
end sub

--
Regards
Frank Kabel
Frankfurt, Germany


Grace wrote:
I have a routine that ultimately selects a range of cells that I want
to use for printing. After highlighting that block, how do I define
that range so that it is set as a print area. When I use record
macro, even with relative references, it seems to only record the,
say, six column range that was selected THIS time, such as F5:g10.
Next time, with different data, the macro will find a longer or
shorter same six-column range and I need code that knows that.

Thanks,
Grace