CFTBrian
10-30-2019, 01:24 PM
When i use the following code it doesn't always show every line.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Vhight As Single
If Target.WrapText = True Then
With Target
.Select
.RowHeight = 2
.WrapText = True
.UnMerge
.EntireRow.AutoFit
Selection.Merge
Vhight = .Width * .Height / Selection.Width
If Vhight < 25 Then Vhight = 25
.RowHeight = Vhight
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlLeft
End With
End If
End Sub
I also have struggled with protecting some of the sheet and having the VBA code work at all.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Vhight As Single
If Target.WrapText = True Then
With Target
.Select
.RowHeight = 2
.WrapText = True
.UnMerge
.EntireRow.AutoFit
Selection.Merge
Vhight = .Width * .Height / Selection.Width
If Vhight < 25 Then Vhight = 25
.RowHeight = Vhight
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlLeft
End With
End If
End Sub
I also have struggled with protecting some of the sheet and having the VBA code work at all.