How to Expand Cells to Fit the Text Automatically in Excel?
Last Updated :
04 Jan, 2023
We all know how useful Excel is to store tabular data. We can do calculations in excel, we can store any information that is in the form of tables, and so on. But there are some common problems that we all face while using Excel. One of the problems that we encounter while entering oversized, overlength data in a cell. Whenever we enter any data that is not fitted in the cell every time we need to resize the column width and that is too frustrating. This article will show you how to make your cells automatically change their width whenever any oversized data is entered.
Steps to make Rows/Columns Fit Text Automatically in Excel
Initially, we have a table with column names “Name” and “Address”.
When we enter the data in the cells the data does not get fully fitted in the cells.
Now, let’s look at the steps to be followed:
Step 1: Right-click on the sheet name in the bottom-left corner.
Step 2: Now select “View Code”.
Step 3: Select “Worksheet” from the drop-down menu as shown in the image.
Step 4: You will see a console window with some code.
Now, Enter the below code of the line in the console on the second line.
Cells.EntireColumn.AutoFit
Now close the window from the file menu.
Step 5: To check if the code is working or not simply click on any cell and press “Enter”. You’ll see that the Column width is now changed as per the length of the data.
Below video will help you to better understand these steps:
Note: To make this feature available permanently for this sheet simply save the file once. So, later, whenever you open the sheet you will still have this feature.