View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default AutoFit macro that will not affect the header row?

Selection.rows.autofit
will work on all the rows in the current selection. Not just the row with the
activecell. So you could select multiple rows before you run that code.

If you want to autofit rows 2 to whatever, you could use:

with activesheet
.rows("2:" & .rows.count).autofit
end with



StargateFanNotAtHome wrote:

I've tried:
Selection.Rows.AutoFit
and
ActiveSheet.Rows.AutoFit

Selection.Rows.AutoFit only affects the active row one is on, which is
not enough. But the ActiveSheet one affects the entire sheet, which
would be okay if there were no header row.

Is there a way to get the macro fine-tuned to ignore the header row,
by any chance?

Thanks! :oD
(XL2003)


--

Dave Peterson