Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The below code looks in a specified dynamic range and for
each item(Persons name) in the range, it removes the comma and then flip flops the name to FIRST LAST from LAST FIRST. It works perfectly for people who do not have a middle initial but for people who have a middle initial, it keeps it there. For example the code as it is now will convert the name Alexander, Tim into Tim Alexander. However a person who has a middle initial is different. If Tims name were Alexander, Tim C. the code would convert it to Tim C. Alexander. I want his name to to be like the rest which would be Tim Alexander. How would I modify the below code to accomplish this? numcount = Application.WorksheetFunction.CountA(Sheets ("Converted Data").Range("F:F")) For Each cell In Sheets("Converted Data").Range("F2:F" & numcount) If Not IsEmpty(cell) Then If InStr(cell, ",") Then sStr = Right(cell, Len(cell) _ - InStr(cell, ",")) cell.Value = Trim(sStr) & " " & _ Trim(Left(cell, _ InStr(cell, ",") - 1)) End If Else Exit For End If Next Thank you Todd Huttenstine |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Remove Invereted Commas | Excel Discussion (Misc queries) | |||
modification to this code | Excel Discussion (Misc queries) | |||
Code modification help | Excel Worksheet Functions | |||
Code Modification | Excel Programming | |||
Modification to code | Excel Programming |