PDA

View Full Version : Solved: Change the place of alphabets to numeric

Sarfaraz
03-09-2013, 03:15 AM
Hi,
I have a work sheet column in which i want to reverse the order of alphabatic numbers like this

1234LSB change to LSB1234
1458C change to C1458
8769TTA change to TTA8769

Would be grateful if somebody suggest a code to this activity automatically
Thanks

sassora
03-09-2013, 07:50 AM
Hi Sarfaraz,

Here's a function I put together that will do what you are suggesting. You can apply this to the cells as needed. Let me know how you get on.

Function LettersAtFront(inputcell As Range) As String

cnt = 1

While IsNumeric(Mid(inputcell, cnt, 1)) And cnt <= Len(inputcell) + 1
cnt = cnt + 1
Wend

If cnt > Len(inputcell) Then
LettersAtFront = inputcell
Else
LettersAtFront = Mid(inputcell, cnt, Len(inputcell)) & Mid(inputcell, 1, cnt - 1)
End If

End Function

snb
03-09-2013, 12:57 PM
=mid(A1,5,10)&left(a1,4)

SamT
03-10-2013, 05:19 PM
Snb,

Always interesting to figure out what your code does.
In this case, from Cell "A1", take the last, up to 10, characters starting at the fifth, then add the first 4 characters.

Requirements:
The numeric character count is always 4.
There are never more than 10 alpha characters.

Doug Robbins
03-11-2013, 01:34 AM
Actually, you don't need the , 10. Mid(A1, 5) will give you everything but the first four characters of A1.

Sarfaraz
03-11-2013, 09:50 PM
Thanks a lot function provided by sasoora worked perfectly fine. Thanks aa lot