Automatically Format cell

A

amber

Is there a way to set the formatting to automatically
adjust cell size based on the text I type in? I know
about using the Format-Autofit, but I'm looking for
something that works while I type.


Thanks, in advance,
Amber
 
F

Frank Kabel

Hi
you'll have to use VBA for this. Put the following code in your
worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A:A")) Is Nothing Then Exit Sub
With Target
If .Value <> "" Then
.Columns.AutoFit
End If
End With
End Sub

this will check entries in column A and if anything is entered applie
the autofit on this column. Change the range to your needs
 
G

Gord Dibben

Amber

No.

When you are typing Excel has no way of knowing what you are doing.

Only after you hit the <ENTER> key or otherwise leave the cell will Excel
respond with the Autofit and other stuff.

I see Frank has provided a macro, but it still involves hitting the <ENTER>
key before the Event is fired.

Gord Dibben Excel MVP
 
F

Frank Kabel

Gord said:
Amber

No.

When you are typing Excel has no way of knowing what you are doing.

Only after you hit the <ENTER> key or otherwise leave the cell will
Excel respond with the Autofit and other stuff.

I see Frank has provided a macro, but it still involves hitting the
<ENTER> key before the Event is fired.

Hi Gord
thanks for this addition, missed this part in the OP question :)
Frank
 
G

Gord Dibben

Fran

The "while I type" part was kinda hidden at the bottom. Who reads that far
down?<g>

Gord
 
Top