How to set cell size in cm (centimeters) in Excel?
On a worksheet, the default units for the row height and column width are preset, and the default column width is 8.38 characters and the default row height is 12.75 points. And in Excel, it is difficult for you to set the row height or column width in inches or centimeters. But, sometimes you need to change the height and width to centimeters for some purpose. How could you solve this problem?
You can’t set the height and width in centimeters with Excel’s functions, except for using VBA code. The below two codes can help you to set column width and row height. Do as follows:
1. Select the cells that you want to set them in centimeters.
2. Click Developer > Visual Basic, a new Microsoft Visual Basic for applications window will be displayed, click Insert > Module, and input the following code into the Module:
Code for setting row height in centimeters:
Dim cm As Single
cm = Application.InputBox("Enter Row Height in Centimeters", _
"Row Height (cm)", Type:=1)
If cm Then
Selection.RowHeight = Application.CentimetersToPoints(cm)
3. Then click button to execute the code. And a prompt box will pop out to tell you to enter a number of row height. See screenshot:
Note: the number you enter must be less than 15. And this VBA code won't change row height if you enter 0 in this dialog box.
4. Click OK. And the row height of the selected cells have been set with 2 centimeters. See screenshot:
If you want to set the column width in centimeters as well, you can input the following code:
Code for setting column width in centimeters:
Dim cm As Single, points As Integer, savewidth As Integer
Dim lowerwidth As Integer, upwidth As Integer, curwidth As Integer
Dim Count As Integer
Application.ScreenUpdating = False
cm = Application.InputBox("Enter Column Width in Centimeters", _
"Column Width (cm)", Type:=1)
If cm = False Then Exit Sub
points = Application.CentimetersToPoints(cm)
savewidth = ActiveCell.ColumnWidth
ActiveCell.ColumnWidth = 255
If points > ActiveCell.Width Then
MsgBox "Width of " & cm & " is too large." & Chr(10) & _
"The maximum value is " & _
Format(ActiveCell.Width / 28.3464566929134, _
"0.00"), vbOKOnly + vbExclamation, "Width Error"
ActiveCell.ColumnWidth = savewidth
lowerwidth = 0
upwidth = 255
ActiveCell.ColumnWidth = 127.5
curwidth = ActiveCell.ColumnWidth
Count = 0
While (ActiveCell.Width <> points) And (Count < 20)
If ActiveCell.Width < points Then
lowerwidth = curwidth
Selection.ColumnWidth = (curwidth + upwidth) / 2
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
curwidth = ActiveCell.ColumnWidth
Count = Count + 1
Set cell size in cm (centimeters) with Kutools for Excel
With the above codes, you can only set cell size in centimeters, today, I will introduce you a multifunctional tool, Kutools for Excel which not only can set cell size in centimeters but also in inches, pound and pixels.
Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
More than 300 powerful features. Supports Office/Excel
2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features
30-day free trial. 60-day money back guarantee.