No such measure as an inch, I'm afraid. The widht of one pixel on your
screen depends on your screen resolution and how large your screen is.
640x480 on a 21 inch monitor makes pretty large pixels...
When it comes to printing, this has to do with DPI (dots per inch) settings
and possible zoom ratio of both the printer and of Excels print menu. There
are just too many variables to convert "what is" into "what seen" and "what
printed" in a sensible way.
Excel cell width has to with "how many default characters visible in a
cell". See Help on this.
HTH. Best wishes Harald
Mike Johnson <mlj...@qwest.net> skrev i
news:251d01c18e91$d508cb50$3def2ecf@TKMSFTNGXA14...
' based on code from
' http://www.erlandsendata.no/english/vba/ws/setrowcolumnmm.htm
Sub SetColumnWidthInch(ColNo As Long, inWidth As Integer)
' changes the column width to inWidth
Dim w As Single
If ColNo < 1 Or ColNo > 255 Then Exit Sub
Application.ScreenUpdating = False
w = Application.InchesToPoints(inWidth)
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 SetRowHeightInch(RowNo As Long, inHeight As Integer)
' changes the row height to inHeight
If RowNo < 1 Or RowNo > 65536 Then Exit Sub
Rows(RowNo).RowHeight = Application.InchesToPoints(inHeight)
End Sub
Sub ChangeWidthAndHeightInch()
'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:
SetColumnWidthInch 2, 1
SetRowHeightInch 2, 1
End Sub