Thread
:
Cycle thru & format all columns
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett[_4_]
external usenet poster
Posts: 2,337
Cycle thru & format all columns
From vbe HELP. Change *2 to +2.
ColumnWidth Property
See Also Applies To Example Specifics
Returns or sets the width of all columns in the specified range. Read/write
Variant.
Remarks
One unit of column width is equal to the width of one character in the
Normal style. For proportional fonts, the width of the character 0 (zero) is
used.
Use the Width property to return the width of a column in points.
If all columns in the range have the same width, the ColumnWidth property
returns the width. If columns in the range have different widths, this
property returns Null.
Example
This example doubles the width of column A on Sheet1.
With Worksheets("Sheet1").Columns("A")
.ColumnWidth = .ColumnWidth * 2
End With
--
Don Guillett
SalesAid Software
"Arawn" wrote in message
om...
I need to cycle thru each column, autofit it, and add 2 character
spaces.
My current code is:
Cells.Select
Selection.EntireColumn.Hidden = False
Selection.EntireRow.Hidden = False
Cells.EntireColumn.AutoFit
Range("A1").Select
Wide = Selection.ColumnWidth
Selection.ColumnWidth = Wide + 2
Range("B1").Select
Wide = Selection.ColumnWidth
Selection.ColumnWidth = Wide + 2
Range("C1").Select
Wide = Selection.ColumnWidth
Selection.ColumnWidth = Wide + 2
Range("D1").Select
Wide = Selection.ColumnWidth
Selection.ColumnWidth = Wide + 2
Etc, etc, etc, all the way to
Range("IV1").Select
Wide = Selection.ColumnWidth
Selection.ColumnWidth = Wide + 2
Although this is functional, it looks like a mess. Any help in
cleaning it up would be greatly appreciated.
~Arawn
Reply With Quote
Don Guillett[_4_]
View Public Profile
Find all posts by Don Guillett[_4_]