I need help to make rows expand to fit the largest text box within that row. I found the code below online, it works perfectly on the spreadsheet it came on but it doesn't work on my spreadsheet.
Any help will be appreciated.
Thanks in advance
Code
Sub Adjust()
Dim cr As Range
Dim ht As Single
Dim mht As Variant
Dim cn As Integer
Dim n As Variant
Dim rp As Integer
Dim i As Integer
n = 1
Application.ScreenUpdating = False
With Sheets(1)
cn = .Shapes.Count
ReDim mht(cn, 2)
For i = 1 To cn
With .Shapes(i)
If .Name Like "TextBox*" Then
Set cr = .TopLeftCell
If i = 1 Then rp = cr.Row
If rp <> cr.Row Then
n = n + 1
rp = cr.Row
End If
ht = .Height
If ht > mht(n, 1) Then mht(n, 1) = ht
mht(n, 2) = rp
End If
End With
Next i
For i = 1 To n
.Rows(mht(i, 2)).RowHeight = mht(i, 1)
Next i
End With
End Sub
Display More