0

I have a macro for sizing a spreadsheet rows and columns precisely in cm. It works like a charm.

My point is that as soon as I fill in the cells with data, the cells columns get resized by the application at the run time (rows size keeps unchanged).

I tried to swap the 2 portions of codes, eg. sizing then filling up with data, and reverse. I get the same result in both cases, e.g. the columns get resized, which I don't want.

I also tried this code below, inserted after having sized the cells and before filling them with data, but this leads to an application error when the code tries to fill in the first data, as I guess it requires to resize the column :

 With oWs
        .Range("A:Z").ShrinkToFit = True
        .Protect "", AllowFormattingRows:=False, AllowFormattingColumns:=False
 End With

The code for width and height sizing is coming from microsoft support.

That's like chicken and egg headhache.

Thx for any workaround.

Community
  • 1
  • 1
hornetbzz
  • 9,188
  • 5
  • 36
  • 53
  • What's your code for sizing? I would think that filling the range and then sizing the columns would take care of your issue (at least it has in situations where I've had to explicitly set a column width) – sous2817 Sep 25 '14 at 15:54
  • After having checked once more to fill in data then size the columns : I confirm the point. – hornetbzz Sep 25 '14 at 15:59

0 Answers0