Is there a way to modify this VBA code to show the second largest word in a cell value?
Function LongestWord(ByVal str As String)
' Returns the longest word in a string of words
Dim x As Variant
Dim i As Long
str = Application.Trim(str)
x = Split(str, " ")
LongestWord = x(0)
For i = 1 To UBound(x)
If Len(x(i)) > Len(LongestWord) Then
LongestWord = x(i)
End If
Next i
End Function
http://www.mrexcel.com/board2/viewtopic.php?p=528592#528592
Function LongestWord(ByVal str As String)
' Returns the longest word in a string of words
Dim x As Variant
Dim i As Long
str = Application.Trim(str)
x = Split(str, " ")
LongestWord = x(0)
For i = 1 To UBound(x)
If Len(x(i)) > Len(LongestWord) Then
LongestWord = x(i)
End If
Next i
End Function
http://www.mrexcel.com/board2/viewtopic.php?p=528592#528592