Hello!
I have some macro:
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 I want to get:
<tbody>
</tbody>
Help me please!
I have some macro:
Code:
Sub bracketsSub()
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) = brackets(CStr(arr(x, 1)))
Next x
Cells(1, 1).Resize(UBound(arr, 1), UBound(arr, 2)).Value = arr
Erase arr
End Sub
Private Function brackets(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, ")")
brackets = Mid(sss, aaa + 1, bbb - aaa - 1)
Exit Function
Error_handler:
brackets = "-no-"
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 I want to get:
A | B | C | D | |
1 | (yes)(no)(don't know)<strike></strike> | yes | no | don't know<strike></strike> |
2 | (yes)(no)<strike></strike> | yes | no | -no- |
3 | (yes)<strike></strike> | yes | -no-<strike></strike> | -no-<strike></strike> |
<tbody>
</tbody>
Help me please!