Good evening!
I have some code:
It's extract some text (first found text) from the brackets "[]" from the strings in the "A" column and copy to "B" column.
What I should do to extract all texts from the brackets?
Example want I to get:
<tbody>
</tbody><strike></strike>
Thanx in advance.
I have some code:
Code:
Sub sqbrackSub()
Dim arr() As Variant
Dim x As Long
x = Cells(Rows.Count, 1).End(xlUp).Row
arr = Cells(1, 1).Resize(x, 2).Value
For x = LBound(arr, 1) To UBound(arr, 1)
arr(x, 2) = sqbrack(CStr(arr(x, 1)))
Next x
Cells(1, 1).Resize(UBound(arr, 1), UBound(arr, 2)).Value = arr
Erase arr
End Sub
Private Function sqbrack(ByRef sss As String) As String
Dim aaa As Long '---
Dim bbb As Long '---
On Error GoTo Error_handler:
aaa = InStr(sss, "(")
bbb = InStr(aaa, sss, ")")
sqbrack = Mid(sss, aaa + 1, bbb - aaa - 1)
Exit Function
Error_handler:
sqbrack = ""
End Function
It's extract some text (first found text) from the brackets "[]" from the strings in the "A" column and copy to "B" column.
What I should do to extract all texts from the brackets?
Example want I to get:
A | B | C | D | |
1 | [red][pink][green] | red | pink | green |
2 | [black][white] | black | white | |
3 | [blue] | blue |
<tbody>
</tbody>
Thanx in advance.