As a second solution to my other post, this will offer a more dynamic approach, which is where the height will update based upon the number of characters (this hasn't been properly tested for upper limits/maximums and so with a large long string/value, it's likely to thrown an exception so I've added a hard coded limit which seems to be around the limit in Excel 2010)
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
Dim defaultHeight As Integer
defaultHeight = 25
Dim maxHeight As Integer
maxHeight = 399
For Each r In ActiveSheet.UsedRange
Dim length As Integer
length = Len(r.Value)
If length > 0 Then
Dim heightToUse As Double
heightToUse = defaultHeight + length
If (heightToUse > maxHeight) Then
r.RowHeight = maxHeight
Else
r.RowHeight = heightToUse
End If
End If
Next r
End Sub
Make sure to add it to the specific worksheet as this fires and re-calculates as you enter new values
How do I add VBA in MS Office?
Before
After (with Middle Align
in the Alignment tab of the ribbon)
Conditional formatting can't change row height, your only option here is to use a macro. However I don't understand why would you need such a formatting. – Máté Juhász – 2017-07-04T12:04:23.290
My real table is a bill containing description of items, when the description is too long it will be wrapped automatically but the cell doesn't show all the text, and I don't want to use autofit rows because I want to use my own values of their heights. (sorry of my bad english) – zarqos.os – 2017-07-04T12:14:54.027
Your question isn't actually clear because telecommunications appears to be in a higher cell but doens't have more than 20 characters... – Dave – 2017-07-04T12:50:27.217
I edited the question and the second statement is more than 10 caracters :) – zarqos.os – 2017-07-04T13:14:20.820
two statements : >=10 or <10 :) – zarqos.os – 2017-07-04T13:39:42.877