![]() |
Standard column width in points...
Hi,
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? TIA, CE |
Standard column width in points...
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 |
All times are GMT +1. The time now is 03:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com