PhosFeedLogisticsMan
New Member
- Joined
- Aug 9, 2017
- Messages
- 17
I don't get why this is not working, but I am trying to clean up and speed up my code.
I currently have this and it works fine within my sub.
However when I replace it with:
Or this:
It will not format the columns. Trying to speed this thing up by getting rid of Select and Selection. What am I doing wrong?
I currently have this and it works fine within my sub.
Code:
Columns("O:Q").Select
Selection.ColumnWidth = 35.01
Columns("A").Select
Selection.ColumnWidth = 6.01
Columns("B").Select
Selection.ColumnWidth = 10.01
Columns("C").Select
Selection.ColumnWidth = 25.01
Columns("D").Select
Selection.ColumnWidth = 6.01
Columns("E").Select
Selection.ColumnWidth = 28.01
Columns("F").Select
Selection.ColumnWidth = 25.01
Columns("G").Select
Selection.ColumnWidth = 10.01
Columns("H").Select
Selection.ColumnWidth = 5.01
Columns("I").Select
Selection.ColumnWidth = 25.01
Columns("J").Select
Selection.ColumnWidth = 20.01
Columns("K").Select
Selection.ColumnWidth = 5.01
Columns("L").Select
Selection.ColumnWidth = 5.01
Columns("M").Select
Selection.ColumnWidth = 5.01
Columns("N").Select
Selection.ColumnWidth = 10.01
Columns("O").Select
Selection.ColumnWidth = 35.01
Columns("P").Select
Selection.ColumnWidth = 25.01
Columns("O:O").Select
Selection.WrapText = True
Selection.MergeCells = False
However when I replace it with:
Code:
Columns("O:Q").ColumnWidth = 35.01
Columns("A").ColumnWidth = 6.01
Columns("B").ColumnWidth = 10.01
Columns("C").ColumnWidth = 25.01
Columns("D").ColumnWidth = 6.01
Columns("E").ColumnWidth = 28.01
Columns("F").ColumnWidth = 25.01
Columns("G").ColumnWidth = 10.01
Columns("H").ColumnWidth = 5.01
Columns("I").ColumnWidth = 25.01
Columns("J").ColumnWidth = 20.01
Columns("K").ColumnWidth = 5.01
Columns("L:M").ColumnWidth = 5.01
Columns("N").ColumnWidth = 10.01
Columns("O").ColumnWidth = 35.01
Columns("P").ColumnWidth = 25.01
Columns("O").WrapText = True
.MergeCells = False
Code:
Columns("O:Q").ColumnWidth = 35.01
Columns("A:A").ColumnWidth = 6.01
Columns("B:B").ColumnWidth = 10.01
Columns("C:C").ColumnWidth = 25.01
Columns("D:D").ColumnWidth = 6.01
Columns("E:E").ColumnWidth = 28.01
Columns("F:F").ColumnWidth = 25.01
Columns("G:G").ColumnWidth = 10.01
Columns("H:H").ColumnWidth = 5.01
Columns("I:I").ColumnWidth = 25.01
Columns("J:J").ColumnWidth = 20.01
Columns("K:K").ColumnWidth = 5.01
Columns("L:L").ColumnWidth = 5.01
Columns("M:M").ColumnWidth = 5.01
Columns("N:N").ColumnWidth = 10.01
Columns("O:O").ColumnWidth = 35.01
Columns("P:P").ColumnWidth = 25.01
Columns("O:O").WrapText = True
Columns("O:O").MergeCells = False
It will not format the columns. Trying to speed this thing up by getting rid of Select and Selection. What am I doing wrong?
Last edited by a moderator: