ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Visual Basic in Excel, Resize the Cell automatically (https://www.excelbanter.com/excel-programming/427326-visual-basic-excel-resize-cell-automatically.html)

Pam

Visual Basic in Excel, Resize the Cell automatically
 
How do I automatically resize a cell in Visual Basic depending on the amount
of text I enter?

Mike H

Visual Basic in Excel, Resize the Cell automatically
 
Pam,

It depends on what you want to do. Like this

Range("A1").Value = "antidisestablishmentarianism"
With Range("A1")
.WrapText = True
End With

or like this

Range("A1").Value = "antidisestablishmentarianism"
Columns("A:A").EntireColumn.AutoFit

Mike

"Pam" wrote:

How do I automatically resize a cell in Visual Basic depending on the amount
of text I enter?


Pam

Visual Basic in Excel, Resize the Cell automatically
 
Perfect. The autofit works like a charm. THANK YOU!!

"Mike H" wrote:

Pam,

It depends on what you want to do. Like this

Range("A1").Value = "antidisestablishmentarianism"
With Range("A1")
.WrapText = True
End With

or like this

Range("A1").Value = "antidisestablishmentarianism"
Columns("A:A").EntireColumn.AutoFit

Mike

"Pam" wrote:

How do I automatically resize a cell in Visual Basic depending on the amount
of text I enter?



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

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