Skip to content
Related Articles
Open in App
Not now

Related Articles

How to Expand Cells to Fit the Text Automatically in Excel?

Improve Article
Save Article
Like Article
  • Last Updated : 04 Jan, 2023
Improve Article
Save Article
Like Article

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.

Console -window-opens


Now, Enter the below code of the line in the console on the second line.




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.

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!