Public Sub InsertChar10()
Dim lastRow As Long
Dim thisRow As Long
Dim thisCol As Long
Dim longestText As Long
Dim longestCol As Long
' Find the last row
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
' Loop through all rows
For thisRow = 1 To lastRow
' Assume for now that the longest cell value is in column A
longestText = Len(Cells(thisRow, 1).Value)
longestCol = 1
' Loop through columns B to J
For thisCol = 2 To 10
' If the value in this column is longer than the current longest value
If Len(Cells(thisRow, thisCol).Value) > longestText Then
' Remember this column
longestCol = thisCol
' Remember the length of the text in this column
longestText = Len(Cells(thisRow, thisCol).Value)
End If
Next thisCol
' Now update the longest column in this row by appending vblf = Chr(10)
Cells(thisRow, longestCol).Value = Cells(thisRow, longestCol).Value & vbLf
Next thisRow
End Sub