ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Cell Width (https://www.excelbanter.com/excel-discussion-misc-queries/215110-cell-width.html)

KB

Cell Width
 
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!


Gord Dibben

Cell Width
 
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!



KB

Cell Width
 
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!




FSt1

Cell Width
 
hi
see this site..
http://www.mrexcel.com/archive/VBA/522.html

it explains how to set up a worksheet change event to autofit the activecell
on enter. complete with code.

Regards
FSt1

"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!


Rick Rothstein

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!






All times are GMT +1. The time now is 08:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com