FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
I found the post below, but was hoping this could be done a manner where the array is written left-to-right versus up and down.
As this is it works for my needs after I expand the ar(1) out to ar(15), just hoping it could be shortened.
I'm starting with column A and setting out to column O with all different column widths.
As this is it works for my needs after I expand the ar(1) out to ar(15), just hoping it could be shortened.
I'm starting with column A and setting out to column O with all different column widths.
Code:
[FONT=Verdana]https://www.mrexcel.com/forum/excel-questions/706877-set-column-widths-array-concept.html[/FONT]
[LEFT][COLOR=#333333][FONT=monospace]Sub cw()
Dim ar(1 To 3)
Dim c As Integer
Dim cnt As Integer
cnt = LBound(ar())
ar(1) = 20
ar(2) = 30
ar(3) = 40
For cnt = LBound(ar()) To UBound(ar())
Columns(cnt).ColumnWidth = ar(cnt)
Next cnt
End Sub[/FONT][/COLOR][/LEFT]
Last edited: