splitting names from one cell to two cells
jock,
I think the issue with doing this, i.e. splitting a cells contents either
side of a "v", is what happens if there's another v in the cell (Dr, Vernon
somename) for example so this may be more difficult than it seems.
However, here's 2 lines of code that split the active cell at the 'v' to the
cells either side
ActiveCell.Offset(, -1).Value = Left(ActiveCell.Value, InStr(1,
ActiveCell.Value, "v", vbTextCompare) - 1)
ActiveCell.Offset(, 1).Value = Mid(ActiveCell.Value, InStr(1,
ActiveCell.Value, "v", vbTextCompare) + 1)
If you post more of your code and some sample data then perhaps it can be
made more specific.
--
Mike
When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
"Jock" wrote:
In cells in column E, I have names (could be John Doe, Dr John Stephen Henry
Doe, could be a company name) which are seperated by the character "v" which
indicates parties on one side versus parties on the other side.
I only need to split the data in cells in E which will be dictated by
ActiveCell.Row
How can I split the data in a cell in E into everything to the left of the
"v" to sheet2, lastrow + 1 (I've already got that bit working) col C, and
everything after the "v" to col E on that same sheet?
The line below currently copies all the data from a cell in wbS, col E to
the other col C on the other sheet. I need to split the data to C and E on
the new sheet (col D will have the v in it).
.Range("C" & lngNewRow).Value = wbS.Range("E" & lngRowNo)
I hope that makes sense!
--
Traa Dy Liooar
Jock
|