![]() |
Column Width
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? |
Column Width
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 (MVP - Excel) "hshayhorn" wrote in message ... 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? |
Column Width
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? -- Hazel "Rick Rothstein" wrote: 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 (MVP - Excel) "hshayhorn" wrote in message ... 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? |
All times are GMT +1. The time now is 08:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com