Hi, I’m trying to format cell selection so that every selection I make ends up as the same total (columns) width, so I can then copy the selection into Powerpoint and it remains exactly the same size – without losing the fonts. I don’t want to resize once I’m in Powerpoint as the font size will not be true.
So far I have this code in Excel, which I would thought would resize any amount of columns, so that the overall width of the collection is the same each time:
Dim myCount as Single.
myCount = selection.columns.count
If myCount < 6 Then
With Selection
.Columns(1).ColumnWidth = 25
Do Until NextNo = myCount + 1
NextNo = NextNo + 1
.Columns(NextNo).ColumnWidth = 40 / myCount
Loop
End With
Else
With Selection
.Columns(1).ColumnWidth = 25
Do Until NextNo = myCount + 1
NextNo = NextNo + 1
.Columns(NextNo).ColumnWidth = 80 / myCount
Loop
End With
End If
Therefore, I would have thought if there were 6 columns or less, the overall width of the selection would be 40, with the column(1) remaining at 25.
And … if there are more than 6 columns, the overall width of the selection should be 80, with column(1) remaining at 25.
However, this is not working. For example, if I select 8 columns, Column(1) ends up with a width of 25 (correct), but columns (2 – 8) end up with a width of 10. Obviously, this totals 95, and I wanted an overall width of 80.
Is there another way I could be doing this? Hope the above makes sense!