ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Autofit Columns (https://www.excelbanter.com/excel-discussion-misc-queries/131147-autofit-columns.html)

falcios

Autofit Columns
 
I know when dates are entered into cells the column automatically autofits.
Is there any way to do that with text. Instead of clicking on
column/format/autofit?
Thanks.

Dave Peterson

Autofit Columns
 
You could use an event macro that autofits the changed cell's columns whenever
you make a change.

If you want to try, rightclick on the worksheet tab that should have this
behavior. Select view code and paste this into the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Target.EntireColumn.AutoFit
End Sub

But be aware that most macros destroy the Edit|Undo and Edit|Redo stack. (I'd
just do it manually so I wouldn't lose that.)





falcios wrote:

I know when dates are entered into cells the column automatically autofits.
Is there any way to do that with text. Instead of clicking on
column/format/autofit?
Thanks.


--

Dave Peterson

John Crosher

Autofit Columns
 
A simpler way to make a column autofit is to hover over the right hand edge
of the column label. When the cursor changes to the double arrow, then double
click.

"falcios" wrote:

I know when dates are entered into cells the column automatically autofits.
Is there any way to do that with text. Instead of clicking on
column/format/autofit?
Thanks.



All times are GMT +1. The time now is 02:36 AM.

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