Fit Row height VBA based on no of lines in a cell.

krshnn

New Member
Joined
Mar 23, 2022
Messages
17
Office Version
  1. 2013
Platform
  1. Windows
I have an Excel sheet wherein different cells have different lines (which are already wrap text-ed). I need to fix the row height to 15 in case of one line in a cell, 30 in case of two lines,45 in case of 3 and so on (i.e., 15 pt per line) ..

Column in which the multiple line may occur is dynamic (i.e., it may occur on D3,C5,F4 and so on).
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try...

VBA Code:
Private Sub Worksheet_Activate()
    Cells.Select
    Selection.EntireRow.autofit
End Sub
 
Upvote 0
Solution
This achieves the wrap text objective but line no multiplied by points are not maintained.
But still, it is useful and I have saved this macro.
Thanks for your assistance.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,193
Members
452,616
Latest member
intern444

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