Question: I'm trying to add columns (or delete them if the number is reduced) between where "ID" and "Total" are based on the cell value in B1.

![Text](https://i.imgur.com/Gi6II06.png)

How could this be done automatically every time the cell is updated? 

Code I have so far

```
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim KeyCells As Range
    Set KeyCells = Range("B1")
    If Not Application.Intersect(KeyCells, Range(Target.Address)) _
      Is Nothing Then
        Dim i As Integer
        For i = 1 To Range("B1").Value
            Columns("C:C").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
        Next i
    End If
End Sub

```

Answer: 
There's a setting in interface builder for estimated size - set it to None.

[![enter image description here](https://i.stack.imgur.com/LvYQx.png)](https://i.stack.imgur.com/LvYQx.png)

Change to None:

[![enter image description here](https://i.stack.imgur.com/4kMTf.png)](https://i.stack.imgur.com/4kMTf.png)
I actually have never worked with XIBs or flow layouts, but I am currently working on some custom collection views: from what I know, in the most general case, it's not the collection view itself who's "choosing self-sizing", it's the layout object.

Collection view on itself or it's delegate do not have any methods that ask cells for their preferred sizes. On the other hand, the flow layout does. [It is known](https://github.com/airbnb/MagazineLayout/blob/64cef3100328f22a093405635946adbc1ca6ad23/MagazineLayout/Public/Views/MagazineLayoutCollectionViewCell.swift#L34-L39) that flow layout checks internally if a cell uses auto layout, and, if the cell does, it ignores the information supplied by the delegate.

One can opt out of that behavior by subclassing the layout and returning false in `shouldInvalidateLayout(forPreferredLayoutAttributes:, withOriginalAttributes:)`.