Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default automatical cell size adjusting

Hi
I've been using excel for a while now, and something that would be really
nice is to have cells resize themselves when word wrap is active, so that you
can just type away and be sure that the cell will stretch himself to display
all the text that you have just typed.

Is there anyone who knows of a way to do this?

Thanks a lot in advance!
Pieka
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default automatical cell size adjusting

If you want the cells to auto-expand after data is typed into them, then
enter this worksheet event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Application.EnableEvents = False
Columns(t.Column).EntireColumn.AutoFit
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200781


"ninjaneer" wrote:

Hi
I've been using excel for a while now, and something that would be really
nice is to have cells resize themselves when word wrap is active, so that you
can just type away and be sure that the cell will stretch himself to display
all the text that you have just typed.

Is there anyone who knows of a way to do this?

Thanks a lot in advance!
Pieka

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default automatical cell size adjusting

Wow, thanks. That's really cool.
Is there a way to get the cells to adjust row height rather than column
width, though?

Pieka

"Gary''s Student" wrote:

If you want the cells to auto-expand after data is typed into them, then
enter this worksheet event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Application.EnableEvents = False
Columns(t.Column).EntireColumn.AutoFit
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200781


"ninjaneer" wrote:

Hi
I've been using excel for a while now, and something that would be really
nice is to have cells resize themselves when word wrap is active, so that you
can just type away and be sure that the cell will stretch himself to display
all the text that you have just typed.

Is there anyone who knows of a way to do this?

Thanks a lot in advance!
Pieka

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default automatical cell size adjusting

Try this instead of the other code:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Application.EnableEvents = False
Rows(t.Row).EntireRow.AutoFit
Application.EnableEvents = True
End Sub


--
Gary''s Student - gsnu200781


"ninjaneer" wrote:

Wow, thanks. That's really cool.
Is there a way to get the cells to adjust row height rather than column
width, though?

Pieka

"Gary''s Student" wrote:

If you want the cells to auto-expand after data is typed into them, then
enter this worksheet event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Application.EnableEvents = False
Columns(t.Column).EntireColumn.AutoFit
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200781


"ninjaneer" wrote:

Hi
I've been using excel for a while now, and something that would be really
nice is to have cells resize themselves when word wrap is active, so that you
can just type away and be sure that the cell will stretch himself to display
all the text that you have just typed.

Is there anyone who knows of a way to do this?

Thanks a lot in advance!
Pieka

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default automatical cell size adjusting

You could use:
t.EntireRow.AutoFit

or
Target.entirerow.autofit

And drop the undeclared(!) variable <vbg.

Gary''s Student wrote:

Try this instead of the other code:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Application.EnableEvents = False
Rows(t.Row).EntireRow.AutoFit
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200781

"ninjaneer" wrote:

Wow, thanks. That's really cool.
Is there a way to get the cells to adjust row height rather than column
width, though?

Pieka

"Gary''s Student" wrote:

If you want the cells to auto-expand after data is typed into them, then
enter this worksheet event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Application.EnableEvents = False
Columns(t.Column).EntireColumn.AutoFit
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200781


"ninjaneer" wrote:

Hi
I've been using excel for a while now, and something that would be really
nice is to have cells resize themselves when word wrap is active, so that you
can just type away and be sure that the cell will stretch himself to display
all the text that you have just typed.

Is there anyone who knows of a way to do this?

Thanks a lot in advance!
Pieka


--

Dave Peterson
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
Adjusting comment box size by Macro yshridhar Excel Discussion (Misc queries) 2 February 5th 08 09:19 AM
can a tab name/# chg. when a cell name/# chgs. automatical Excel LauryC Excel Worksheet Functions 1 November 12th 07 06:25 PM
Adjusting toolbar size, restore toolbar Josh M Excel Discussion (Misc queries) 1 January 18th 06 06:17 PM
adjusting cell size in spreadsheets [email protected] Excel Discussion (Misc queries) 5 December 21st 05 05:59 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


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

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

About Us

"It's about Microsoft Excel"