Seperate letters and numbers in a cell
Here is an example using columns A, B, & C:
Sub split_um()
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
Cells(i, "B").Value = ""
Cells(i, "C").Value = ""
v = Cells(i, "A").Value
For j = 1 To Len(v)
ch = Mid(v, j, 1)
If IsNumeric(ch) Then
Cells(i, "C").Value = Cells(i, "C").Value & ch
Else
Cells(i, "B").Value = Cells(i, "B").Value & ch
End If
Next
Next
End Sub
--
Gary''s Student - gsnu200768
"Keith S" wrote:
I have a spreadsheet where one column has cells with letters and numbers. I
want to seperate the letters into one cell and the numbers into another cell.
For example:
Cell Prefix Suffix
abcd041 abcd 041
qjwxkl678 qjwxkl 678
abc1455 abc 1455
Thanks for any help on this.
|