Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
lambola
 
Posts: n/a
Default Column widths to adjust automatically?

How do I get column widths to automatically adjust depending on the size of
text entered in a cell ?
  #2   Report Post  
Jimbola
 
Posts: n/a
Default

The only way to do it would be to use a change event macro.
With the workbook open press Alt+F11, this take you to the visual basic
editor.
In the left double click the worksheet where you want the code.
Past the following code.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim r As Range

'Set range, so we are looking for text entered in A1:A500, change this as
needed.
Set r = Intersect(Range("A1:A5"), Target)

'If the change in the worksheet is not detected, exit the macro.
If r Is Nothing Then Exit Sub

'If text is entered do autofit on the column
Columns("A:A").EntireColumn.AutoFit



End Sub


"lambola" wrote:

How do I get column widths to automatically adjust depending on the size of
text entered in a cell ?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
what formula do i put for column m = column k minus column l in e. jenniss Excel Discussion (Misc queries) 5 January 6th 05 08:18 PM
Vary the column widths for different rows Marty Excel Discussion (Misc queries) 2 January 4th 05 11:08 PM
How do I adjust column widths only on selected cells? karla Excel Discussion (Misc queries) 2 December 27th 04 02:10 PM
How do I fix column widths in Excel Pivot Tables? skeezix Excel Discussion (Misc queries) 1 December 11th 04 12:43 AM
How do I sort a column of formulas in Excel? Gordon Excel Discussion (Misc queries) 2 November 27th 04 01:55 AM


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"