Resize table in excel. Extending cells in Microsoft Excel

As well as in word program, Excel has the ability to format tables - that is, bring them into a decent, well-designed form.

You can change the height and width of the cell, the size and appearance of the font, the position of the text in the cell, the borders and the cell fill. Cells can also be merged (i.e. merged). In this article, I will talk about cell resizing.

Method one.

Edit line heightyou can manually.

Step 1.

Move the mouse pointer over the line that separates the lines in the very first column - the column with line numbers. The pointer changes from a normal arrow to a double black arrow with a separator. This is how it will look:

Step 2.

Hold the left button mouse and, not letting go her, drag the pointer up (or down). As soon as you expand the line to the desired height, release the left button. The line height will change.

And you can make it even easier. Execute step 1... Only instead of dragging the changed pointer, do left double click mouse on bottom line border. The row height will automatically adjust to the size of your text in the cell.

Edit column width can be exactly the same as the height. Move the mouse pointer over the line that separates the columns in the very first row - the row with the column names. It will change again.

Can change height and width several rows and columns.

Step 1.

Highlight the rows or columns you want. ATTENTION! You need to highlight them wholly!

Step 2.

As with changing one row (or column), move the cursor to any border of the selected rows (columns), wait for it to change and drag it to the desired width or height. The width (height) of all selected columns or rows will change.


Method two.

You can also change the height and width using the program itself.

Step 1.

Select the cells you want to resize.

Step 2.

Go to the menu tab "The main" and find the command block on it "Cells".

Step 3.

Left click on the button "Format".A menu will appear.

Step 4.

To change the size of the cell, we need commands that are collected in a block "Cell size".

If you left click on the commands "Line height ..."or "Column width ...",then you will see the following windows:

Here you can enter the size (height or width) from the keyboard and click the button OK... Experiment and see how the cell resizes.

To generally have an idea of \u200b\u200bthe size of the column (row), hover your mouse to the border of the desired column (row) (as you did at the very beginning when manually resizing), clampleft mouse button and do not move the pointer anywhere... A tooltip with dimensions appears next to the pointer.

If you select teams "Auto-fit line height" or "AutoFit Column Width",then the program will set the dimensions itself so that all the data fit in the cell. That is, the height (and width) will be matched to the longest (widest) given (word, number) in the column (row).

Cell resizing in VBA Excel: setting row height, column width, auto-fitting cell width depending on the size of the content.

Cell size

The size of a cell in terms of height and width is determined by the height of the row and the width of the column at the intersection of which it is located. If, in your case, it is undesirable to resize the entire row or the entire column, use the merged cells of the desired size.

Note that the row height is in points and the column width is in characters, so their numeric values \u200b\u200bdo not match in actual size.

Row height and column width in Excel

Programmatically, without additional macros, you can change the line height only in points, and the column width only in characters.

The Microsoft Office Applications Support site says about these values:

  • line height can range from 0 to 409 points, with 1 point approximately equal to 1/72 inch or 0.035 cm;
  • column width can range from 0 to 255, and this value corresponds to the number of characters that can be displayed in the cell.

Line height

Use the RowHeight property of the Range object to change the row height. And it doesn't matter, the Range object will be a selected arbitrary range, a separate cell, whole row or whole column - the height of all rows that intersect with the Range object will be changed after the RowHeight property of this object is set to a new value.

Examples of changing line heights:

Example 1

Changing the height of an individual cell:

ActiveCell.RowHeight \u003d 10

as a result, the row in which the active cell is located becomes 10 points high.

Example 2

Changing the line height:

Rows (3) .RowHeight \u003d 30

as a result, the third row of the worksheet is 30 points high.

Example 3

Changing the height of cells in a given range:

Range ("A1: D6"). RowHeight \u003d 20

as a result, each of the first six rows of the worksheet will be set to a height of 20 points.

Example 4

Changing the height of cells in an entire column:

Columns (5) .RowHeight \u003d 15

as a result, all rows of the worksheet will be assigned a height of 15 points.

Column width

Use the ColumnWidth property of the Range object to change the column width. As in the case of row height, it doesn't matter if the Range object will be a selected arbitrary range, a single cell, an entire row, or an entire column - the width of all columns intersecting with the Range object will be changed after the ColumnWidth property of this object is set to a new value.

Examples of changing column widths:

Example 1

Changing the width of an individual cell:

ActiveCell.ColumnWidth \u003d 15

as a result, the column containing the active cell becomes 15 characters wide.

Example 2

Changing column width:

Columns (3) .ColumnWidth \u003d 50

as a result, the third column of the worksheet (column "C") becomes 50 characters wide.

Example 3

Change the width of the cells of a given range:

Range ("A1: D6"). ColumnWidth \u003d 25

as a result, each of the first four columns of the worksheet will be set to a width of 25 characters.

Example 4

Changing the width of the cells of the whole line:

Rows (4) .ColumnWidth \u003d 35

as a result, all columns in the worksheet will be assigned a width of 35 characters.

AutoFit Width

Use the following code to auto-fit the width of the cell to the size of its content:

"for example, let's write some text in any cell of the worksheet, for example, this: Cells (5, 5) \u003d" Auto-fit cell width "" now adjust the width of the cell, or rather "the column in which this cell is located: Cells ( 5, 5) .EntireColumn.AutoFit

Note that the width of the column will be adjusted to fit the cell with the longest content in that column. For example, if the length of the contents of Cells (7, 5) exceeds the length of the contents of Cells (5, 5), then the auto-fit of the fifth column will be based on the contents of Cells (7, 5), despite the fact that the code line contains another cell.

Quite often, the contents of a cell in a table do not fit within the default borders. In this case, the issue of expanding them becomes relevant so that all information fits and is in full view of the user. Let's find out in what ways you can do this procedure in Excel.

There are several options for expanding cells. Some of them provide for manual pushing of boundaries by the user, while others can be used to set up automatic execution of this procedure depending on the length of the content.

Method 1: simple drag and drop borders

The easiest and most intuitive way to increase the cell size is to manually drag the borders. This can be done on the vertical and horizontal scales of the coordinates of rows and columns.




Attention! If, on the horizontal scale of coordinates, you position the cursor on the left border of the expandable column, and on the vertical scale, on the upper border of the row, following the procedure for dragging, then the sizes of the target cells will not increase. They will simply move to the side by changing the size of other sheet elements.

Method 2: expand multiple columns and rows

There is also the option to expand multiple columns or rows at the same time.




Method 3: manually entering the size via the context menu

You can also manually enter the size of the cells, measured in numerical values. By default, the height is 12.75 units and the width is 8.43 units. You can increase the height to a maximum of 409 points and the width to 255.



The height of the lines is changed in a similar way.



The above manipulations allow you to increase the width and height of the cells in units of measurement.

Method 4: enter the size of the cells through the button on the ribbon

In addition, it is possible to set the specified cell size through the button on the ribbon.




Method 5: increase the size of all cells in a sheet or workbook

There are situations when you need to enlarge absolutely all cells of a sheet or even a book. Let's figure out how to do this.




We perform similar actions to increase the size of the cells of the entire book. Just to select all the sheets, we use a different technique.



Method 6: auto-fit

This method cannot be called a full-fledged increase in the size of the cells, but, nevertheless, it also helps to completely fit the text into the existing borders. With its help, the text characters are automatically reduced so that it fits into the cell. Thus, we can say that its size relative to the text increases.