Auto adjust height of rows 6+

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Select them and then double click one of the separating lines.

1. Click on the 6 to highlight the whole row
2. Press "CTRL+SHIFT+DOWN"
3. Double click the line between any two rows
 
Upvote 0
Sheets are not "opened" they are "activated"

So do you mean when the "Workbook" is "opened" or the "Worksheet" is "activated"

And if when the "Workbook" is opened do you want this to happen on all sheets or which sheet?
 
Upvote 0
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window
This code will only activate when you activate the sheet.
To activate the sheet you will need to activate another sheet then when you come back to this sheet it will be activated.
If you only have one sheet then we may need a "When Open Workbook" script.
Let me know.


Code:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Dim Lastrow As Long
Lastrow = Rows(ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row).Row
Rows("6:" & Lastrow).AutoFit
Application.ScreenUpdating = True
End Sub

OK
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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