Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 150
Default Excel column width

How can I make columns auto adjust the width to fit the data as I put it in
without having to go to auto fit width after I enter the data?


--
stan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Excel column width

A good question. Put this macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set clA = Range("A:A")
If Intersect(t, clA) Is Nothing Then Exit Sub
clA.Columns.AutoFit
End Sub

It is coded for column A. After any change in a column A cell, the column
width is automatically adjusted.
--
Gary''s Student - gsnu200800


"stan" wrote:

How can I make columns auto adjust the width to fit the data as I put it in
without having to go to auto fit width after I enter the data?


--
stan

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 150
Default Excel column width

A good answer, if I just understood it!

More simple, please?

Thanks

--
stan


"Gary''s Student" wrote:

A good question. Put this macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set clA = Range("A:A")
If Intersect(t, clA) Is Nothing Then Exit Sub
clA.Columns.AutoFit
End Sub

It is coded for column A. After any change in a column A cell, the column
width is automatically adjusted.
--
Gary''s Student - gsnu200800


"stan" wrote:

How can I make columns auto adjust the width to fit the data as I put it in
without having to go to auto fit width after I enter the data?


--
stan

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Excel column width

Go to the worksheet where you want to have this functionality, right click
the tab at the bottom of the worksheet and select View Code from the popup
menu that appears, then copy/paste the code Gary''s Student posted into the
code window that appears. If Column A is not the correct column (you didn't
tell us what column you were interested in, so Gary''s Student guessed at
Column A), then change the "A:A" argument in the Range("A:A") function call
to the column letters you actually want. That is it... when you type an
entry into Column A (or whatever column you change it to), the column will
automatically "AutoFit" when an entry is made into it. By the way, you can
use this simpler code I posted back to Gary''s Student in place of the code
he offered you.

Rick


"stan" wrote in message
...
A good answer, if I just understood it!

More simple, please?

Thanks

--
stan


"Gary''s Student" wrote:

A good question. Put this macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set clA = Range("A:A")
If Intersect(t, clA) Is Nothing Then Exit Sub
clA.Columns.AutoFit
End Sub

It is coded for column A. After any change in a column A cell, the
column
width is automatically adjusted.
--
Gary''s Student - gsnu200800


"stan" wrote:

How can I make columns auto adjust the width to fit the data as I put
it in
without having to go to auto fit width after I enter the data?


--
stan


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 150
Default Excel column width

Thank you!
--
stan


"Rick Rothstein (MVP - VB)" wrote:

Go to the worksheet where you want to have this functionality, right click
the tab at the bottom of the worksheet and select View Code from the popup
menu that appears, then copy/paste the code Gary''s Student posted into the
code window that appears. If Column A is not the correct column (you didn't
tell us what column you were interested in, so Gary''s Student guessed at
Column A), then change the "A:A" argument in the Range("A:A") function call
to the column letters you actually want. That is it... when you type an
entry into Column A (or whatever column you change it to), the column will
automatically "AutoFit" when an entry is made into it. By the way, you can
use this simpler code I posted back to Gary''s Student in place of the code
he offered you.

Rick


"stan" wrote in message
...
A good answer, if I just understood it!

More simple, please?

Thanks

--
stan


"Gary''s Student" wrote:

A good question. Put this macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set clA = Range("A:A")
If Intersect(t, clA) Is Nothing Then Exit Sub
clA.Columns.AutoFit
End Sub

It is coded for column A. After any change in a column A cell, the
column
width is automatically adjusted.
--
Gary''s Student - gsnu200800


"stan" wrote:

How can I make columns auto adjust the width to fit the data as I put
it in
without having to go to auto fit width after I enter the data?


--
stan





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Excel column width

Here is a simpler event code procedure which will do the same thing...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then Target.Columns.AutoFit
End Sub

Rick


"Gary''s Student" wrote in message
...
A good question. Put this macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set clA = Range("A:A")
If Intersect(t, clA) Is Nothing Then Exit Sub
clA.Columns.AutoFit
End Sub

It is coded for column A. After any change in a column A cell, the column
width is automatically adjusted.
--
Gary''s Student - gsnu200800


"stan" wrote:

How can I make columns auto adjust the width to fit the data as I put it
in
without having to go to auto fit width after I enter the data?


--
stan


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i lock the column width in Excel? Kashif Kazmi Excel Discussion (Misc queries) 1 March 3rd 08 10:57 AM
Importing into Excel: column width scubadiver Excel Discussion (Misc queries) 1 July 23rd 07 11:08 AM
how do I create multiple column width in the same column in excel Vish Excel Discussion (Misc queries) 9 November 3rd 06 11:49 PM
How to make cell width different than the column width it lies in John Excel Discussion (Misc queries) 2 September 11th 06 10:41 PM
Excel - CSV Format and column width [email protected] Excel Discussion (Misc queries) 7 June 9th 05 07:40 PM


All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"