Visual Basic for Applications (VBA)
Hey Josh,
Here is one suggestion...
The specified range in this code starts in cell A1 of the worksheet and the first blank defines the end of the data in Column A. The text, within brackets < >, is copied to the opposite cells in Column B
Sub CopyAndDepositTextWithinBrackets()
Dim rngCell As Range
Dim strName As String
Dim OpenBracket As Integer
Dim CloseBracket As Integer
For Each rngCell In Range("A1", Range("A1").End(xlDown))
strName = rngCell.Value
OpenBracket = InStr(1, strName, "<")
CloseBracket = InStr(1, strName, ">")
rngCell.Offset(0, 1).Value = Mid(strName, _
OpenBracket + 1, CloseBracket - OpenBracket - 1)
Next rngCell
End Sub
Best Regards
Cathrine
Or like this
Dim r As Range
For Each r In Range("A1", "A" & Range("A1").SpecialCells(xlLastCell).Row)
If r Like "*<*>*" Then r.Offset(, 1).Value = Split(Split(r, Chr(60))(1), Chr(62))(0)
Next
Hey,
Here you go¡
Sub CopyAndDepositTextWithinBrackets()
'Declaring variables like Integers and Strings, and object types like Ranges
Dim rngCell As Range
Dim strName As String
Dim OpenBracket As Integer
Dim CloseBracket As Integer
'Define a For..Next loop from cell A1 to the last entry in column A
For Each rngCell In Range("A1", Range("A1").End(xlDown))
'Store the entry in the rngCell
strName = rngCell.Value
'Find the position of the brackets
OpenBracket = InStr(1, strName, "<")
CloseBracket = InStr(1, strName, ">")
'Extract the value inside the brackets and write it to the next cell to the right
rngCell.Offset(0, 1).Value = Mid(strName, _
OpenBracket + 1, CloseBracket - OpenBracket - 1)
'Loop until all cells is done
Next rngCell
End Sub
Cath
¡remember to mark the answer as answered if it was what you were looking fore