Get Text to Fit in Cell in Excel

Spreadsheet Planet

When we work in Excel, the cell content does not always fit the cell size. In such situations, some options available to us include text wrapping, changing the row height and column width, etc.

But there are times when we need to shrink the text and get it t fit into a cell without affecting the layout of our Excel sheet. One scenario would be where you need to print your data and don’t want to increase the column width.

In this article, I will show you simple methods that we can use to get the text to fit in cells in Excel (shrink-to-fit text in Excel).

Table of Contents

Using the Format Cells Option

In Excel, we can quickly and automatically reduce the text to fit into a cell. However, most Excel users do not use the shrink text to fit in a cell feature.

The main reason is that when a text is lengthy, sometimes, after shrinking, the text becomes so small and difficult to read.

However, when we have restrictions on changing the layout (for example, we are not permitted to change the column width or row height), this is the best option for us.

Below I have a table that shows answers to three questions, and the text does not fit the cell completely.

Text not fitting in the cell and needs to be shrinked

I want to shrink the text to fit in cells for row 1. I can do this by following the below steps.

  1. Select the cells that we want to shrink text to fit in cells. So, I select cells B1 to D1.

Select the cells that you want to shrink

  1. Go to the “Home” tab.

Click the home tab

  1. Click on the “Alignment Settings” Expansion icon.

 Click on the dialog box expansion icon

Then, Excel will open the “Format Cells” dialog box and I am in the “Alignment” tab of the “Format Cells” dialog box.

Select the alignment tab in the format cells dialog box

  1. Go to the “Text control” group and check “Shrink to fit”.

Check the shrink to fit option

  1. Click the “OK” button.

 Click the OK button

As soon as I click the “OK” button, Excel shrinks the selected text to fit the cell.

Text in cells have shrunk and now fit in the cell

Now, I can see the full questions inside each cell without adjusting row height or column width.

We can also open the “Format Cells” dialog box using the following two ways.

Using the Excel Keyboard Shortcut

Some Excel users prefer to use keyboard shortcuts. There is an Excel shortcut to shrink text to fit in a cell in Excel.

Below I have a table that shows answers to three questions, and the text does not fit the cell completely.

Text not fitting in the cell and needs to be shrinked

I want to shrink the text to fit in cells for row 1. After selecting the cells that I want to apply shrink to fit, I can use the below shortcut.

ALT + H + F + A + (ALT +K) + Enter

I have to use the above shortcut as follows.

  1. Select the cells that I want to apply “Shrink to fit”. So, in this case, I am selecting cells B1 to D1.

Text not fitting in the cell and needs to be shrinked

  1. Press the below keys one after another.
ALT + H + F + A

When I press the above keys one after another, I will get the “Format Cells” dialog box. The active tab of the “Format Cells” dialog box is the “Alignment” tab.

Select the alignment tab in the format cells dialog box

  1. Then I have to press the ALT key and the letter “K” together. In other words, I have to hold down the ALT key and press “K”.

Check the shrink to fit option

When I use these keys, the “Shrink to fit” of the “Text Control” group will be checked.

  1. Finally, I have to press the ‘Enter’ key.

As soon as I press the “Enter” key, Excel shrinks the selected text to fit the cell.

Text in cells have shrunk and now fit in the cell

Now, I can see the full questions inside each cell without adjusting row height or column width.

Using VBA Code to Fit Text in Cells in Excel

Sometimes we like to do our Excel work with just a click of a button.

If we want to shrink text to fit in a cell in Excel with just a click of a button, we have to enter a VBA code.

Below I have a table that shows answers to three questions, and the text does not fit the cell completely.

Text not fitting in the cell and needs to be shrinked

I want to shrink text to fit in cells for row 1 with just a click of a button.

The below VBA code helps me to shrink text to fit in a cell in Excel.

'Code developed by Steve Scott from https://spreadsheetplanet.com Sub Shrink_to_fit() Selection.ShrinkToFit = True End Sub 

To apply the above VBA code, I have to do the following steps.

  1. Press ALT + F11 keys to open the VBA Editor. If the function keys are locked, I have to press the Fn key as well. I have to press ALT + F11 keys together.

VB editor of Excel

  1. Expand the “Insert” menu of the VBA Editor dialog box and click “Module”.

Insert a new module for the workbook

  1. Copy and paste the above VBA code into the Module.

Enter the code in the module code window

  1. Click the Save button.

Save the code

  1. Click “No” in the pop-up message.

Click on the No button

  1. Save the workbook as an “Excel Macro-Enabled Workbook (*.xlsm).

Save as Excel macro enabled workbook

  1. Go to the “Insert” tab of the Excel file. Expand the “Illustrations”. Expand “Shapes”. Click on the rectangle shape and draw a rectangle.

Enter a shape

  1. Type “Shrink-to-Text” inside the rectangle.

Type “Shrink-to-Text” inside the rectangle.

  1. Select the Shape and right-click on it. Then, select “Assign Macro…” from the context Menu.

Click on assign macro option

  1. Select the Macro name from the “Assign Macro” dialog box and click the “OK” button.

Assign the shrink to fit macro

Now I can shrink text to fit in the selected cells by just clicking the “Shrink-to-Fit” button. So, I am selecting cells B1 to D1 and clicking the “Shrink-to-Text” button.

Click on the button to run the macro

As soon as I click the “Shrink-to-Text” button, Excel will shrink the text to fit in the selected cells.

Text in the cells would shrink

Now, you have learned three methods to shrink text to fit in a cell in Excel. After we shrink the text, always remember to check the readability of the text.

Other Excel articles you may also like:

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.

1 thought on “Get Text to Fit in Cell in Excel”

Dominic Cooper

I have never had the idea to shrink text, i am glad upon practicing this lesson I am able to do it on my own. Thanks so kindly.
Dominic Cooper Reply

Leave a Comment Cancel reply

MOST POPULAR ARTICLES

spreadsheetplanet.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com