From: Khan on
Hi Guys !!

I want to learn auto column width VBA application. When I enter data
in the column, column width should adjust according to size of DATA.
Can somebody help ! I will appreciate your efforts. Thanks in
advance.

From: Per Jessen on
Hi

This is an event code, so it has to be inserted into the codesheet for the
desired sheet. Also, the column width will never be less than 8:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.EntireColumn.AutoFit
If Target.ColumnWidth < 8 Then
Target.ColumnWidth = 8
End If
End Sub

Regards,
Per

"Khan" <aldehides(a)hotmail.com> skrev i meddelelsen
news:34714810-ba5a-43fe-abe1-1c490e3c56ac(a)g21g2000yqk.googlegroups.com...
> Hi Guys !!
>
> I want to learn auto column width VBA application. When I enter data
> in the column, column width should adjust according to size of DATA.
> Can somebody help ! I will appreciate your efforts. Thanks in
> advance.
>
From: Mike H on
Hi,

Alt+F11 to open VB editor. Double click the worksheet you want this on and
paste the code below in

Private Sub Worksheet_Change(ByVal Target As Range)
Columns(Target.Column).EntireColumn.AutoFit
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Khan" wrote:

> Hi Guys !!
>
> I want to learn auto column width VBA application. When I enter data
> in the column, column width should adjust according to size of DATA.
> Can somebody help ! I will appreciate your efforts. Thanks in
> advance.
>
> .
>
From: Khan on
On May 1, 12:47 pm, Mike H <Mi...(a)discussions.microsoft.com> wrote:
> Hi,
>
> Alt+F11 to open VB editor. Double click the worksheet you want this on and
> paste the code below in
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Columns(Target.Column).EntireColumn.AutoFit
> End Sub
> --
> Mike
>
> When competing hypotheses are otherwise equal, adopt the hypothesis that
> introduces the fewest assumptions while still sufficiently answering the
> question.
>
>
>
> "Khan" wrote:
> > Hi Guys !!
>
> > I want to learn auto column width VBA application. When I enter data
> > in the column, column width should adjust according to size of DATA.
> > Can somebody help !  I will appreciate your efforts. Thanks in
> > advance.
>
> > .- Hide quoted text -
>
> - Show quoted text -

Dear Mike,

Thank you very much for this great help !

Khan
 | 
Pages: 1
Prev: not enough resources
Next: Two codes in one set.