PDA

View Full Version : Auto adjust for cells according to value using VBA



LalitPandey87
10-06-2011, 08:19 AM
Hi,

Is it possoble through VBA to auto size the cell width according to the value in it.

Thanx in Advance.:cool:

Excel Fox
10-06-2011, 08:23 AM
Are you looking for
Activecell.EntireColumn.Autofit? This will adjust the width of the column. If this is not what you are looking for, can you clarify with an example?

Mahesh
10-06-2011, 11:37 AM
Perhaps ! u can use this also


Sub test()
Dim sht As Worksheet
For Each sht In ThisWorkbook.Worksheets
On Error Resume Next
sht.Activate
Cells.EntireColumn.AutoFit
Next sht
End Sub

LalitPandey87
11-08-2011, 08:58 AM
Thanx for this useful function.
Working!
:cool: