|
▼すぺぺぺ さん:
Sub test2()
Dim a As Object
Dim r As Range
Dim w, v, k As Long
Dim s As String, n As Long
Set a = CreateObject("system.collections.arraylist")
Set r = Range("A1", ActiveSheet.UsedRange).Offset(1).Resize(, 4)
w = r.Value
For k = 1 To UBound(w)
v = Application.Index(w, k, 0)
a.Add v
s = v(4)
If s Like "?*[((]?*[))]" Then
n = InStr(Replace(s, "(", "("), "(")
v(4) = Left(s, n - 1)
a(a.Count - 1) = v
a.Add Array(Mid(s, n), Empty, Empty, Empty)
End If
Next
r.Resize(a.Count).Value = Application.Index(a.toarray, 0, 0)
End Sub
|
|