0

I'm trying to size a series of pairs of columns with this code:

Columns(7 + 2 * x - 1).Select
Selection.ColumnWidth = 7

Columns(7 + 2 * x).Select
Selection.ColumnWidth = 14

Where x is a variable allowing me to move across the pairs of columns

But both columns end up with width 14.

Any suggestions?

David
  • 1

1 Answers1

0

First: No need to use Select, read https://stackoverflow.com/a/10717999/7599798`. So it is sufficient to write

Columns(7 + 2 * x - 1).ColumnWidth = 7

Second: You are referring to the ActiveSheet (the sheet that has the focus). Are you sure you want this ? The linked answer also explains details for this.

FunThomas
  • 23,043
  • 3
  • 18
  • 34