How to copy part of text to other cell

March 25, 2011 at 04:31:15
Specs: Windows XP
Hi everyone,

This is what I'm working with in excel:

In one column I have varying names of organisms, followed by more info between brackets. Now I only need to have that information between brackets into the next column, each time in the cell next to it. Can anyone help me with a script for this? I have been doing it manually, but there are over 3000 cells... Any help would be much appreciated.

See More: How to copy part of text to other cell

Report •

March 25, 2011 at 12:19:07
Here's how to parse the string, but I don't know how to navigate down the rows.

Sub string_filter()
x = Worksheets("Sheet1").Range("A1")
a = InStr(x, "[")
b = InStr(x, "]")
c = Mid(x, a + 1, b - a - 1)

Application.ActiveCell.Formula = c

End Sub

Report •

March 25, 2011 at 12:20:00
Post an example of your data, before & after

If your data, with the brackets, is in Cell B1
Put this formula in Cell C1
drag down for as many rows as needed.

=MID(B1,FIND("[", B1)+1,LEN(B1)-FIND("[", B1)-1)


Report •

Related Solutions

Ask Question