ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Adjust the size of cells automatically (https://www.excelbanter.com/excel-discussion-misc-queries/44032-adjust-size-cells-automatically.html)

Dajana

Adjust the size of cells automatically
 
I need to adjust the size of cells automatically. I am copying information
from one sheet to another automatically and depending on what amount of
information is copied the size of these cells has to adjust automatically or
at least increase to accomodate all text. Is there any way to do this?

Thanks

Ken Johnson

Dajana,
This worked for me:
Paste this code into ThisWorkbook code module in the VBA Editor

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Target.Columns.AutoFit
End Sub

Ken Johnson



All times are GMT +1. The time now is 05:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com