Change default height for autfit

Juujjj

New Member
Joined
Jun 6, 2018
Messages
2
Hi, I'm new to the forum and kind of new to vba.

I'm working on a table formatting code, and I want to change the default autofit height. That's it. I want to be able to wrap text and have the table dynamically resize the height of the row based on that, but I want to be able to set the row height.

I feel like this should be able to be set in settings, but I can't figure it out. If I need to include it in my vba code, I will.

Thanks in advance for your help,

Juujjj
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Right click the sheet that contains the table and view code - paste the following into the VBA window that opens.
Now when you update a table on this sheet it will autofit the row-height, you can then manually adjust the row-height if needed. Once you change the text it will autofit again.

Code:
Private Sub Worksheet_TableUpdate(ByVal Target As TableObject)
ActiveRow.AutoFit
End Sub
 
Last edited:
Upvote 0
I think you misunderstand me. I am looking to change the height to which autofit aligns. Say, I want the row height to be 20 by default, instead of 12 for autofit. I want to be able to set the default row height, but have it double or triple according to how many rows of text there are.
 
Upvote 0

Forum statistics

Threads
1,215,771
Messages
6,126,799
Members
449,337
Latest member
BBV123

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