divide a string words separated by (number)

June 03rd, 2010 - 05:46 pm ET by ferde | Report spam
I would like to have the data that is in one cell parsed into two cells like
in the example below. The data is always separated by a consecutive whole
number in parenthesis . Thank you
A
(1.) White Dog (2.) Black Cat


A B
White Dog Black Cat
email Follow the discussionReplies 3 repliesReplies Make a reply

Replies

#1 Don Guillett
June 03rd, 2010 - 06:50 pm ET | Report spam
Sub SplitCellswith()
For Each n In Range("h2:h6")
c = Application.Substitute(n, " ", "")
p1 = InStr(1, Trim(c), ")")
p2 = InStr(p1 + 1, c, ")") + 1
p3 = InStr(p1 + 1, c, "(") - 1
n.Offset(, 1) = Mid(c, p2, 256)
n.Offset(, 0) = Mid(c, p1 + 1, p3 - p1)
Next n
End Sub


Don Guillett
Microsoft MVP Excel
SalesAid Software

"ferde" wrote in message
news:
I would like to have the data that is in one cell parsed into two cells
like
in the example below. The data is always separated by a consecutive whole
number in parenthesis . Thank you
A
(1.) White Dog (2.) Black Cat


A B
White Dog Black Cat

Similar topics