![]() |
AutoFit macro that will not affect the header row?
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) |
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 |
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 |
All times are GMT +1. The time now is 01:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com