#1   Report Post  
oranskeer
 
Posts: n/a
Default Column Auto Sizing

How do I make a column automatically resize to grow as large as the data
input in a cell automatically (not having to use the autofit column format
option)?
  #2   Report Post  
Jim Rech
 
Posts: n/a
Default

Since Excel 97 column widths expand automatically for numerical entries
unless they have been manually set to some width. Format, Column, AutoFit
Selection sets the autofit property back on for columns that have been
manually adjusted. Column widths do not expand for text entries.

--
Jim Rech
Excel MVP
"oranskeer" wrote in message
...
| How do I make a column automatically resize to grow as large as the data
| input in a cell automatically (not having to use the autofit column format
| option)?


  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

You could use a worksheet_change event if the cell was changing because of your
typing:

Rightclick on the worksheet tab that should have this behavior. Select view
code and paste this into the code window.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Target.EntireColumn.AutoFit
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Did you know that you could autofit columns (and rows) by doubleclicking on that
vertical bar between the column headings.

You can even select all the cells and get all the columns at once with just one
double click.

oranskeer wrote:

How do I make a column automatically resize to grow as large as the data
input in a cell automatically (not having to use the autofit column format
option)?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Column Auto Sizing

This code does the trick, but disables 'undo'.
Is there a way to have our cake and eat it too?

"Dave Peterson" wrote:

You could use a worksheet_change event if the cell was changing because of your
typing:

Rightclick on the worksheet tab that should have this behavior. Select view
code and paste this into the code window.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Target.EntireColumn.AutoFit
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Did you know that you could autofit columns (and rows) by doubleclicking on that
vertical bar between the column headings.

You can even select all the cells and get all the columns at once with just one
double click.

oranskeer wrote:

How do I make a column automatically resize to grow as large as the data
input in a cell automatically (not having to use the autofit column format
option)?


--

Dave Peterson

Reply
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
Putting text in a column based on variable text from another colum Jacky D. Excel Discussion (Misc queries) 1 December 16th 04 07:09 PM
Change the width of a single column in a column chart Dave Charts and Charting in Excel 2 December 13th 04 08:25 PM
How do I set up a click "column title" and auto arrange data form. Max Excel Discussion (Misc queries) 1 December 3rd 04 05:44 PM
How do I sort a column of formulas in Excel? Gordon Excel Discussion (Misc queries) 2 November 27th 04 02:55 AM
How do I sort a column of formulas in Excel? Gordon Excel Discussion (Misc queries) 0 November 26th 04 04:19 PM


All times are GMT +1. The time now is 10:02 AM.

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

About Us

"It's about Microsoft Excel"