Quote Originally Posted by Andy Pope View Post
The example just uses the active cell as input and outputs to immediate window.
You would need to specify in the code what cells it should be used on and where the result goes.

Function GetTextBetweenBrackets(Text As String) As String

    Dim OutText As String
    Dim Index As Long
    Dim StartPos As Long
    Dim BetweenBrackets As Boolean
    
    For Index = 1 To Len(Text)
        If Mid(Text, Index, 1) = ">" Then
            BetweenBrackets = True
            StartPos = Index
        ElseIf Mid(Text, Index, 1) = "<" Then
            If BetweenBrackets Then
                OutText = OutText & Mid(Text, StartPos + 1, Index - StartPos - 1)
            End If
            BetweenBrackets = False
        End If
    Next
    GetTextBetweenBrackets = OutText
    
End Function


Sub Test()

    Dim Data As Range
    Dim Cell As Range
    
    Set Data = Range("G1:G4")
    For Each Cell In Data.Cells
        Cell.Offset(0, 1) = GetTextBetweenBrackets(Cell.Value)
    Next
    
End Sub
Andy - the Function is working fine.

Do you mind tweaking the code to remove all instances of &nbsp; ?

Example:

Input: <p>KW 18 8x21DCF &nbsp;POWERVIEW Folding Series 383ft/1000yds 128m/1000m with case</p>
Output: KW 18 8x21DCF POWERVIEW Folding Series 383ft/1000yds 128m/1000m with case

Note: there can be multiple instances of &nbsp; in any given cell data.