Most valuable professional
  • Hot Topics

Excel AutoFit Cell via VBA?

How would you best go about auto fitting column width? I am using a sub procedure to insert new row(s), contingent on the user's input, into a worksheet, however it would be nice to have the data to be completely visible after the row(s) has been inserted. I suppose this also needs to be done every time a new row is inserted, rather than just once, blatantly because new data could be longer than previous data entered. So far, I have thought to use this: Columns().AutoFit It also appears as though both of these are different in nature, how do I be judicious about which to use? Columns("A:H").AutoFit Range("A1:H1").Columns.AutoFit I have also heard the use of the Excel VBA 'EntireRow' property, would this help in any way?

This question generated 12 answers. To proceed to the answers, click here.

This thread is current as of October 7, 2014.

For more resources for Microsoft Excel:

This article includes the following tags:

  • Excel
  • Microsoft Excel