Skip to main content

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?

Set cell size in cm (centimeters) with VBA code

Set cell size in cm (centimeters) with Kutools for Excelgood idea3


arrow blue right bubble Set cell size in cm (centimeters) with VBA code

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:

Sub RowHeightInCentimeters()
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)
End If
End Sub

3. Then click doc-multiply-calculation-3 button to execute the code. And a prompt box will pop out to tell you to enter a number of row height. See screenshot:

doc-set-cell-size-cm1

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:

doc-set-cell-size-cm2 -2 doc-set-cell-size-cm3

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:

Sub ColumnWidthInCentimeters()
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
Exit Sub
End If
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
Else
upwidth = curwidth
Selection.ColumnWidth = (curwidth + lowerwidth) / 2
End If
curwidth = ActiveCell.ColumnWidth
Count = Count + 1
Wend
End Sub

arrow blue right bubble 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.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)

1.Highlight the cells that you want to set them in centimeters.

2. Click Kutools > Format > Adjust Cell Size, see screenshot:

doc set cell size cm9

3. In the Adjust Cell Size dialog box, choose the Unit type you need and specify the Row height and Column width from Set values section. See screenshot:

doc set cell size in cm 5

4. Then click OK or Apply. You will get cells with 2 cm row height and 3cm column width.

doc-set-cell-size-cm6


arrow blue right bubble Set cell size in cm (centimeters) with Kutools for Excel

Kutools for Excel: 300 + functions you must have in Excel, 30-day free trial from here.

Related articles:

Set column width and row height for a range

How to square multiple cells in Excel?

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thank you. I used your idea to compare ColumnWidth and Width, and it was very helpful. I did this function in Object Pascal and want to share it with you. Thanks. procedure ActiveCellColumnWidthInCentimeters(ExcelApp: Variant; CM: Double); var dColumnWidth, dWidth, points: Double; begin dColumnWidth := ExcelApp.ActiveCell.ColumnWidth; dWidth := ExcelApp.ActiveCell.Width; points := ExcelApp.CentimetersToPoints(CM); ExcelApp.ActiveCell.ColumnWidth := ((points * dColumnWidth) / dWidth); end;
This comment was minimized by the moderator on the site
Seems redundant. Just go into the regular column size dialogue and add "cm" after typing the size.
This comment was minimized by the moderator on the site
Needed this badly. Thank you so much!
This comment was minimized by the moderator on the site
Wow - that is awesome! I needed to set cells to print at a certain size. I have never been able to figure out how to do that before. Yay for VBA!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations