PC Review


Reply
Thread Tools Rate Thread

Column Width

 
 
Khan
Guest
Posts: n/a
 
      1st May 2010
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.

 
Reply With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      1st May 2010
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" <(E-Mail Removed)> skrev i meddelelsen
news:34714810-ba5a-43fe-abe1-(E-Mail Removed)...
> 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.
>

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      1st May 2010
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.
>
> .
>

 
Reply With Quote
 
Khan
Guest
Posts: n/a
 
      2nd May 2010
On May 1, 12:47*pm, Mike H <Mi...@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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot paste source column width to destination column width transkawa Microsoft Excel New Users 1 15th Oct 2010 04:09 PM
Dynamically Resize Gridview Width Property (NOT Column Width) Hartman_Ralph@Hotmail.com Microsoft ASP .NET 0 2nd Jun 2009 04:59 PM
Change table width when changing width of a column Tom Doster Microsoft Powerpoint 0 9th Jan 2009 03:52 PM
Create a macro which takes a column name and width and sets the column width to what it should be Ag Microsoft Excel Programming 4 29th Sep 2007 11:29 PM
sum of multiple columns width differs from single column width Sven Passig Microsoft Excel Programming 0 4th Feb 2004 10:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:46 AM.