LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default AutoFit macro that will not affect the header row?

On Wed, 16 Jul 2008 20:02:26 -0500, Dave Peterson
wrote:

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


<sigh Perfect! Thank you so much.

Another piece of code to add to my Tips folder, too! <g

Thanks and cheers. :oD

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to affect all sheets REMB Excel Discussion (Misc queries) 3 June 4th 10 09:03 PM
Autofit (Columns.EntireColumn.AutoFit) does not work Michiel via OfficeKB.com Excel Discussion (Misc queries) 3 February 10th 09 05:29 PM
How do I stop Macro from affect other Workbooks B Baggins Excel Programming 2 November 23rd 06 09:09 AM
How can I Run a query from VB macro with out affect current data in the same sheet? oafdl Excel Discussion (Misc queries) 0 May 29th 06 09:42 PM
Add-In - OnAction Can't Find Macro & Subs Doesn't Affect Current Wkb [email protected] Excel Programming 6 August 13th 05 12:11 AM


All times are GMT +1. The time now is 06:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"