Text manipulation
paulinoluciano wrote:
Thank you Harlan Grove!
In fact, this solve my first "problem" related to this kind of text
manipulation. However, now I have to specify in such VBA code that the
sequence could be cut after or before two or more letters
simultaneously.
Example:
The sequence is
IADASFDTYEREPWQNMSDFGHKEASADSASSASADRASERAS
cut after K or R
0 lost:
IADASFDTYER
EPWQNMSDFGHK
EASADSASSASADR
SER
AS
1 lost cut:
IADASFDTYEREPWQNMSDFGHK
EPWQNMSDFGHKEASADSASSASADR
EASADSASSASADRSER
SERAS
.....
Harlan Grove wrote:
Bob Phillips wrote...
...
If nIndex = 1 Then
Cells(i, "A").Value = Right(Cells(i, "A").Value, _
Len(Cells(i, "A").Value) - 1)
Else
Cells(i, "A").Value = Left(Cells(i, "A").Value, nIndex - 1) & _
Right(Cells(i, "A").Value, Len(Cells(i, "A").Value) - nIndex)
End If
...
Could simplify: Right(x, Len(x) - y) == Mid(x, y + 1)
Then again, the whole If block could be replaced by
Cells(i, "A").Value = _
Application.WorksheetFunction.Replace(Cells(i, "A").Value, nIndex,
1, "")
|