title: How to autofit column width with VBA?
body: <pre><code>Sub RowHeightMin()
      Dim finalRow As Integer
      Dim i As Integer
      
      finalRow = Cells(Rows.Count, 1).End(xlUp).Row
      
      Range(&quot;A1:A&quot; &amp; finalRow).EntireRow.AutoFit
      
      For i = 2 To finalRow
          If Range(&quot;A&quot; &amp; i).EntireRow.RowHeight &lt; 27 Then
              Range(&quot;A&quot; &amp; i).EntireRow.RowHeight = 27
          End If
      Next i
  End Sub
  </code></pre>
  <p>I have this as an example for a row autofit adjust, but just like for it's column counterpart.</p>
  <p>Autofit would be based on it's row B cells.</p>
  <p>Thank you in advance.</p>