View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
egun egun is offline
external usenet poster
 
Posts: 88
Default 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