Excel column width
Go to the worksheet where you want to have this functionality, right click
the tab at the bottom of the worksheet and select View Code from the popup
menu that appears, then copy/paste the code Gary''s Student posted into the
code window that appears. If Column A is not the correct column (you didn't
tell us what column you were interested in, so Gary''s Student guessed at
Column A), then change the "A:A" argument in the Range("A:A") function call
to the column letters you actually want. That is it... when you type an
entry into Column A (or whatever column you change it to), the column will
automatically "AutoFit" when an entry is made into it. By the way, you can
use this simpler code I posted back to Gary''s Student in place of the code
he offered you.
Rick
"stan" wrote in message
...
A good answer, if I just understood it!
More simple, please?
Thanks
--
stan
"Gary''s Student" wrote:
A good question. Put this macro in the worksheet code area:
Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set clA = Range("A:A")
If Intersect(t, clA) Is Nothing Then Exit Sub
clA.Columns.AutoFit
End Sub
It is coded for column A. After any change in a column A cell, the
column
width is automatically adjusted.
--
Gary''s Student - gsnu200800
"stan" wrote:
How can I make columns auto adjust the width to fit the data as I put
it in
without having to go to auto fit width after I enter the data?
--
stan
|