Thread: Cell Width
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Cell Width

Are you talking about this functionality for every cell on the worksheet? If
so, right click the tab at the bottom of the worksheet, select View Code
from the popup menu and copy paste the code below into the code window that
appeared...

'************* START OF CODE *************
Dim LastColumn As Long

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If LastColumn 0 Then
Application.ScreenUpdating = False
Columns(LastColumn).AutoFit
Application.ScreenUpdating = True
End If
LastColumn = Target.Column
End Sub
'************* END OF CODE *************

If you do not want this functionality for the whole sheet, then tell us for
what cells you do want it for.

--
Rick (MVP - Excel)


"KB" wrote in message
...
I tried it and it adjusted the column width to what is already on the
worksheet, but did not adjust as I entered in new information.

"Gord Dibben" wrote:

FormatColumnAutofit Selection for width.

FormatRowAutofit for height.

Note you can also turn on wordwrap.

Entire rows and entire columns will adjust.

You cannot adjust individual cells.


Gord Dibben MS Excel MVP

On Thu, 1 Jan 2009 15:41:00 -0800, KB
wrote:

I need cells to automatically adjust to fit text entered.
This text will be entered by others after I complete the workbook.

Thanks for your help!