Column Width

  • Thread starter Thread starter hshayhorn
  • Start date Start date
H

hshayhorn

Is there a way to have the column width auto adjust to the width of the text
that is entered? For example if I start with a width of 20 and after data is
entered into the cell if the cell is to small have the cell adjust it's width
without the user having to do anything?
 
Is this what you are looking for? Right-click the tab at the bottom of the
sheet where you want this functionality to occur, select View Code from the
popup menu that appears and copy/paste the following into the code window
that opened up...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 7 Then Target.EntireColumn.AutoFit
End Sub

Change the 7 to the column number of the column you want this functionality
for. Go back to the worksheet and enter some values into the column you
specified.
 
Rick--I think you saved my sanity! If we can take your instruction one step
further...I have approximately 80 columns (consecutively) that need this
adjustment. Is there a way to command this adjustment for all of those
columns at the same time, or do I have to repeat this process 80 times?
 
Back
Top