Preventing Rows from automatically resizing with text

vanilladan

Board Regular
Joined
Sep 24, 2002
Messages
145
Hey,
I want to fix the height of certain rows on my spreadsheet. In the left-most column I have a key to the spreadsheet, columns to the right contain data. The problem comes when I sort the data in the right-hand cols (obviously not including the left col in the DataSort): Excel automatically resizes the rows to accomodate the greater amount of text - i.e. it AutoFits the Row Height.

Can I stop Excel from resizing cells the way you can with objects, text-boxes, etc?

The cells are formatted to wrap-text, but I would have thought this irrelevant.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
On 2002-09-25 06:15, vanilladan wrote:
Hey,
I want to fix the height of certain rows on my spreadsheet. In the left-most column I have a key to the spreadsheet, columns to the right contain data. The problem comes when I sort the data in the right-hand cols (obviously not including the left col in the DataSort): Excel automatically resizes the rows to accomodate the greater amount of text - i.e. it AutoFits the Row Height.

Can I stop Excel from resizing cells the way you can with objects, text-boxes, etc?

The cells are formatted to wrap-text, but I would have thought this irrelevant.

Hi,

Welcome to the board,

Why would you think have wrap text is irrelevent?
That basically what you asking Excel to do, i.e. if too long wrap text.
 
Upvote 0
hello, welcome to the board

i am not sure why you want to fix the height of these rows, but you could do this using VBA. right-click on the excel icon to left of the word 'file' on the menu bar, in the upper left-hand corner of your screen. from the pop-up menu, choose 'view code'. this opens the VBE screen. on the left side of the screen you will see a list of all of sheets in the workbook, as well as 'this workbook'. double click on the sheet you that you want to adjust the row height in, to open that sheet's object window. this is where you will insert the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Application.ScreenUpdating = False
If Target.Row = 1 or Target.Row = 2 or Target.Row = 3 Then
Rows("1:1").RowHeight = 12.75
Rows("2:2").RowHeight = 12.75
Rows("3:3").RowHeight = 12.75
Application.ScreenUpdating = True
End Sub

This sample code would adjust rows 1, 2, and 3 to a height of 12.75, each time rows 1, 2, or 3 are changed. modify the code to suit your own needs as far as which rows you want to adjust, and the height they need to be adjusted to.

HTH
kevin
 
Upvote 0

Forum statistics

Threads
1,222,404
Messages
6,165,853
Members
451,987
Latest member
Johnzdz

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