Can anyone help with this please?
I have a column where cells contain strings separated by the delimiter ';'
For each cell, if it contains certain strings I'd like to copy the strings and the associated characters up to the delimiter into column Offset(0,1) or Offset(0,2) depending on the string.
In many cases there are more than one string in the same cell (so MyStr1 and MyStr3 for example). If so I want to join them with a forward slash ' / '
Please see the example below:
If cell contains MyStr1 I want to copy MyStr1 and the characters up to the first ';' into cell Offset(0,1).
If cell contains MyStr2 or MyStr3 I want to copy both strings with the characters up to the first ';' into cell Offset(0,2) with MyStr2 and MyStr3 separated by ' / '.
Here is an example of the cell contents:
Fin: +123456789;Called (Same): Robert Jones;Called: Rob Jonez
In this case I'd like to copy MyStr1 and the characters up to the first ';' into Offset(0,1) and copy MyStr2 and MyStr3 with characters up to the ';' into Offset(0,2) separated by ' /'.
Note that there is never a delimiter ';' at the end of the string in any cell.
I am trying to avoid coding this using text-to-columns due to unpredictable number of the strings existing.
Any help with this is very much appreciated in advance.
I have a column where cells contain strings separated by the delimiter ';'
For each cell, if it contains certain strings I'd like to copy the strings and the associated characters up to the delimiter into column Offset(0,1) or Offset(0,2) depending on the string.
In many cases there are more than one string in the same cell (so MyStr1 and MyStr3 for example). If so I want to join them with a forward slash ' / '
Please see the example below:
Code:
Dim MyStr1 As String, MyStr2 As String, MyStr3 AS String
MyStr1 = "Fin: "
MyStr2 = "Called (Same): "
MyStr3 = "Called: "
If cell contains MyStr1 I want to copy MyStr1 and the characters up to the first ';' into cell Offset(0,1).
If cell contains MyStr2 or MyStr3 I want to copy both strings with the characters up to the first ';' into cell Offset(0,2) with MyStr2 and MyStr3 separated by ' / '.
Here is an example of the cell contents:
Fin: +123456789;Called (Same): Robert Jones;Called: Rob Jonez
In this case I'd like to copy MyStr1 and the characters up to the first ';' into Offset(0,1) and copy MyStr2 and MyStr3 with characters up to the ';' into Offset(0,2) separated by ' /'.
Note that there is never a delimiter ';' at the end of the string in any cell.
I am trying to avoid coding this using text-to-columns due to unpredictable number of the strings existing.
Any help with this is very much appreciated in advance.