Re : Excel – Width of a Column and PointsToScreenPixelsX

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top