Splitting cell data into multiple cell information
1. How can I take a long selection of cells and remove in every case the last
character?
Sub test1()
Dim c As Range
For Each c In Selection
c.Value = Left(c.Value, Len(c.Value) - 1)
Next c
End Sub
2. Is there a way in a long selection of data I can eliminate all characters
in a string to the left of or right of a single character or more usefully a
common series of characters in a string? eg., if the word "Contact" appears
in every string how can i get split the data so that everything before the
word "Contact"is separated?
Sub test2()
Dim c As Range
For Each c In Selection
If c.Value Like "*Contact*" Then
c.Value = Right(c.Value, Len(c.Value) - InStr(1, c.Value,
"Contact") + 1)
End If
'if instr(1,c.Value,contact = Left(c.Value, Len(c.Value) - 1)
Next c
End Sub
HTH
Daniel
|