Whats wrong with that?
Columns("A:E").Width = Application.Array(5, 10, 5, 10, 5)
Thanks in advance
2 things I see right of are..
The Application object does not support an *Array* property (or
method);
Ranges do not have a *Width* property. Instead, they support
*ColumnWidth* and so your statement should read...
Columns("A:E").ColumnWidth = Array(5, 10, 5, 10, 5)
...but this is very slow to process (took about 1.5 minutes on my
machine) as a single statement. This will work orders of magnitude
faster (instantaneous) ...
Sub SetColWidths()
Dim vWidths, n&, j&
vWidths = Array(5, 10, 5, 10, 5)
With Range("A:E")
For n = 1 To .Columns.Count
.Columns(n).ColumnWidth = vWidths(j): j = j + 1
Next 'n
End With 'Range("A:E")
End Sub
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion