Cell only expands vertically

bbeier

New Member
Joined
Dec 22, 2003
Messages
4
Hi,

I'm in desperate need to be able to type in cells G3 through G34 and the cell expands vertically (not horizontally) with my writing. I'm currently using "Word Wrap." I would also like to be able to use bullet points (rich text) and press the "enter" button without the focus moving to a different cell.
Right now word wrap works until all the vertical space has been used, and then just shows "########" across the width of the cell.
All help is sincerely appreciated!!!
:confused:
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I have the feeling that this was dealt with in some detail previously, so it's in the archive, but I can't think what the terms of the reference were...

Someone gave a very concise and useful code for it previously.

:unsure:
 
Upvote 0
Are you using <Alt>+<Enter> at the end of each line of text to embed a CarriageReturn? (Or is it a LineFeed? I forget.)
 
Upvote 0
Such speedy reply the week of Christmas, I'm speechless!!
The alt + enter is a big help - thank you.
There is an article entitled "Auto Expand" and I've been trying to play around with the code, but can't get it to work.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Cells.Columns.AutoFit
End Sub

Do I have to specify the Range or Target??
:pray:
 
Upvote 0
Hi Brad and welcome to the board,
When I tried your Autofit code it did nothing. You might want to change it to this:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Cells.Columns.AutoFit
End Sub

You would only need to specify a range if you want only that range to autofit your entries. (Right now you have it set for the entire sheet.) An example for limiting the columns you want this done in would be:
Columns("A:D").AutoFit - for only columns A through D.

If you want only a specific range to autofit, you could write your code something like this:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column > 4 Or Target.Row > 10 Then Exit Sub
Target.Columns.AutoFit
End Sub
This will autofit for only columns A through D, and only when there is an entry made in the range A1:D10.

As for being able to press Enter and have the active cell stay where it is, go into Tools > Options > Edit tab and uncheck the "Move Selection After Enter" checkbox. (It’s the fourth one down on the left side.) This will set that to be the case in all your excel applications though.

Hope some of this helps,
Dan
 
Upvote 0
Hi Dan:

The Workbook_SheetChange event code needs to be installed in ThisWorkbook and the code applies to every sheet of the workbook

in contrast to

The Worksheet_Change event code is installed in a worksheet and applies to that particular worksheet only.

So the code for the Workbook_SheetChange event when installed in the right place does work.
 
Upvote 0
Ah yes Yogi,
I see the error of my ways, and you're right about where I place it.
Thanks.
Dan
 
Upvote 0
All the responses have been tremendously usefull - thank you.
The autofit code will come in handy for a couple other spreadsheets I'm using, but still wondering if there is a way where autofit will only expand the cells vertically, instead of horizontally.
:biggrin:
 
Upvote 0
Hi Brad.
I was thinking about your question again and now I'm wondering...what do you mean by using "Word Wrap"? (Is this actually "Wrap text"?) Because that seems to be doing just what you've asked for.
(Highlight cells G3 through G34 and choose Format > Cells > Alignment tab and check "Wrap text" in the lower left hand corner.) This will increase the height of the entire row though, but what I was thinking of doing would have done that anyway.

Is Word Wrap something different, or are you actually using Wrap text and it isn't working for you?

Dan
 
Upvote 0

Forum statistics

Threads
1,203,741
Messages
6,057,097
Members
444,905
Latest member
Iamtryingman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top