ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Columnwidth in cm? (https://www.excelbanter.com/excel-programming/417566-columnwidth-cm.html)

Charlotte E.[_2_]

Columnwidth in cm?
 
Is it possible to set the columnwidth in cm., instead of 'default chars'???



egun

Columnwidth in cm?
 
Something like this might work:

Sub Macro1()
Dim a As Double, b As Double, c As Double, d As Double
'
a = Columns("A:A").ColumnWidth ' Width in "standard" characters
b = Columns("A:A").Width ' Width in points (1/72 inch) - read only
c = b / a ' Number of points per "standard" character
width
d = 2.54 * b / 72# ' Width in cm
MsgBox ("Chars = " & a & Chr(10) & "Points = " & b & Chr(10) & "cm = " &
d)
'
' Set the column width to 5.5 cm:
'
Columns("A:A").ColumnWidth = 5.5 / d * a
'
End Sub

Eric

Gord Dibben

Columnwidth in cm?
 
If you want to use VBA to set height and width in mm.

Ole Erlandson has code for setting row and column dimensions.

http://www.erlandsendata.no/english/...vbawssetrowcol


Gord Dibben Excel MVP

On Wed, 24 Sep 2008 17:49:29 +0200, "Charlotte E." <@ wrote:

Is it possible to set the columnwidth in cm., instead of 'default chars'???



Charlotte E.[_2_]

Columnwidth in cm?
 
Thanks to both of you - I'll look into your suggestions ...


Charlotte E. wrote:
Is it possible to set the columnwidth in cm., instead of 'default
chars'???





All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com