Hello to all.
The attached macro found on the net:
Option Explicit
Sub SetColumnWidthMM(ColNo As Long, mmWidth As Integer)
' changes the column width to mmWidth
Dim w As Single
If ColNo < 1 Or ColNo > 255 Then Exit Sub
Application.ScreenUpdating = False
w = Application.CentimetersToPoints(mmWidth / 10)
While Columns(ColNo + 1).Left - Columns(ColNo).Left - 0.1 > w
Columns(ColNo).ColumnWidth = Columns(ColNo).ColumnWidth - 0.1
Wend
While Columns(ColNo + 1).Left - Columns(ColNo).Left + 0.1 < w
Columns(ColNo).ColumnWidth = Columns(ColNo).ColumnWidth + 0.1
Wend
End Sub
Sub SetRowHeightMM(RowNo As Long, mmHeight As Integer)
' changes the row height to mmHeight
If RowNo < 1 Or RowNo > 65536 Then Exit Sub
Rows(RowNo).RowHeight = Application.CentimetersToPoints(mmHeight / 10)
End Sub
'This example macro shows how you can set the row height for row 3 and the column width for column C to 3.5 cm:
Sub ChangeWidthAndHeight()
SetColumnWidthMM 1, 8 '<<< colonna 1,8 = A L=8mm
SetRowHeightMM 3, 8 '<<< riga 3,8 = riga 3 L=8mm
End Sub
They are not accurate.
you can change the calculation with this macro?
'Sub rigacolonna()
'Selection.RowHeight = (295.2 / 100) * 10 ' <<< 10 = height rows choice
Selection.ColumnWidth = (45.9 / 100) * 10 '<<< 10 = width colums choice
' End Sub
Bookmarks