T
TKT-Tang
Re : Excel – Width of a Column and PointsToScreenPixelsX
1. Say, set a worksheet column width to 50.
2. By clicking the right hand side border of the column in the
heading, it shows 355 pixels.
3. The method, PointsToScreenPixelsX, computes the column width to be
294 pixels.
4. Please enlighten upon the discrepancy as shown.
5. The following code may illustrate :-
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Msg As String
ActiveCell.ColumnWidth = 50
Msg = "The width of the selected cell may be " &
ActiveWindow.PointsToScreenPixelsX(ActiveCell.Width) & " pixels." &
Chr(10)
Msg = Msg & "However, by clicking the right hand side border in the
column heading," & Chr(10)
Msg = Msg & "it shows 355 pixels."
MsgBox Msg
End Sub
6. Regards.
1. Say, set a worksheet column width to 50.
2. By clicking the right hand side border of the column in the
heading, it shows 355 pixels.
3. The method, PointsToScreenPixelsX, computes the column width to be
294 pixels.
4. Please enlighten upon the discrepancy as shown.
5. The following code may illustrate :-
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Msg As String
ActiveCell.ColumnWidth = 50
Msg = "The width of the selected cell may be " &
ActiveWindow.PointsToScreenPixelsX(ActiveCell.Width) & " pixels." &
Chr(10)
Msg = Msg & "However, by clicking the right hand side border in the
column heading," & Chr(10)
Msg = Msg & "it shows 355 pixels."
MsgBox Msg
End Sub
6. Regards.