MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Feb 19th, 2002, 06:05 PM   #1
bomalley
New Member
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 21
Default

Hi there,

Does anyone know how to make row height automatic after changing values in cells.
I have data in a cell that automatically word wraps, and increases the height of the row. However if that data changes, the row height stays the same, rather than shrinking (if the length of the data is less).
bomalley is offline   Reply With Quote
Old Feb 19th, 2002, 06:12 PM   #2
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

Howdy,

Does it help if you select format cell -> alignment -> wrap text?

Hope so. Cheers, Nate
NateO is offline   Reply With Quote
Old Feb 19th, 2002, 06:14 PM   #3
bomalley
New Member
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 21
Default

I can do that, but if the cell data changes, it doesn't automatically shrink or expand the row height accordingly.
bomalley is offline   Reply With Quote
Old Feb 19th, 2002, 06:14 PM   #4
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

It does for me, XL 2000....
NateO is offline   Reply With Quote
Old Feb 19th, 2002, 06:18 PM   #5
bomalley
New Member
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 21
Default

Using Excel 97 (at work)
bomalley is offline   Reply With Quote
Old Feb 19th, 2002, 06:21 PM   #6
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,064
Default

Hi guys

Im sure i have had this before i use 97 at work and 2000 or XP(2002) at home and 97 fails this test higher levels of XL will

HTH
Rdgs
==========
Jack

PS so if im right you will be on 97 i hope!

Sorry a fix. ui have this every day and i ignor it and ever so often coffe btraek i select all and double click a line limit on the left side that the slider to the row adjustment and its junps and re jiggs to fit nicley.

Crude but work for me..
HTH
Jack in the UK is offline   Reply With Quote
Old Feb 19th, 2002, 06:23 PM   #7
bomalley
New Member
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 21
Default

Yep - I do that too - I was just hopeful of a way I could make it automatic
bomalley is offline   Reply With Quote
Old Feb 19th, 2002, 06:38 PM   #8
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

Bo,

Right click on the worksheet in question. Click on 'View Code.'

Paste:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Application.Intersect(Target, Range("A1:f100")) Is Nothing Then
Rows("1:100").AutoFit
End If
End Sub


Change the ranges so that they're appropriate. Close the vb editor and give it a shot.

Cheers,

Nate

[ This Message was edited by: NateO on 2002-02-19 17:38 ]
NateO is offline   Reply With Quote
Old Feb 19th, 2002, 07:08 PM   #9
bomalley
New Member
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 21
Default

You are a god Nate. This works fantastically. One more question though, can I change it so that that macro runs on a change to a drop down menu control I have on the sheet? I don't know VBA very well, so am not sure of the code changes I would need to make.
bomalley is offline   Reply With Quote
Old Feb 19th, 2002, 07:36 PM   #10
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

Bo, thanks! I'm now at a terminal without Excel, so I'm not testing this, but try the following (same process, right click on the sheet):

1) If you want a macro to run, try this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:f100")) Is Nothing Then
application.run("Bo's Macro Right Here")
End If
End Sub

2) If you want the user to be shot to a cell with data validation try this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:f100")) Is Nothing Then
range("a1").select
End If
End Sub

Again, change the cell ranges as appropriate. And if it's a macro (scenario 1), write the macro name without 'sub.' You can slide the autofit line in this too (within the 'if' statement) if it works as anticipated.

Hope this helps.

Cheers,

Nate

[ This Message was edited by: NateO on 2002-02-19 18:51 ]
NateO is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On

Forum Jump


All times are GMT -4. The time now is 06:41 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes