View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nirmal Singh Nirmal Singh is offline
external usenet poster
 
Posts: 17
Default Setting the Width of a column

On Fri, 27 May 2005 11:47:44 -0400, "Bernie Deitrick" <deitbe @ consumer dot org wrote:

You can get close (but never get exact due to limitations on the accuracy of
the character size) using something like:

Sub Macro1()
Dim NewWidth As Double

NewWidth = 17

With Range("A1").EntireColumn
MsgBox "Column A was this wide: " & .Width
.ColumnWidth = NewWidth * .ColumnWidth / .Width
.ColumnWidth = NewWidth * .ColumnWidth / .Width
MsgBox "Column A is this now wide: " & .Width
End With

End Sub

Thanks Bernie, that's close enough for me.

Nirmal