Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I can read the standard column width of a sheet with
ActiveSheet.StandardWidth ...but this gives me the width in chars.... How to get the standard columnwidth in points? More specifically StandardWidth returns the number of 'standard' characters of the "Normal" font that will fit in the column (by defaullt 8 with some padding) You could try something like this Sub test() MsgBox StdWidthToPoints(ActiveSheet) & " points" End Sub Function StdWidthToPoints(ws As Worksheet) Dim sngOldW As Single sngOldW = -1 If ws.Range("A:A").ColumnWidth < ws.StandardWidth Then sngOldW = ws.Range("A1").ColumnWidth ' will error if protected ws.Range("A:A").ColumnWidth = ws.StandardWidth End If StdWidthToPoints = ws.Range("A1").Width If sngOldW = 0 Then ws.Range("A:A").ColumnWidth = sngOldW End If End Function Regards, Peter T |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Standard Paper sizes not the right number of points | Excel Programming | |||
Excel 2007 Standard column width | Excel Discussion (Misc queries) | |||
Create a macro which takes a column name and width and sets the column width to what it should be | Excel Programming | |||
change standard column width | Setting up and Configuration of Excel |