• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

SOLVED: Thank you armstrda!

KingstonU

Golden Member
So I have a cell with a hundred first and last names in the order of "L,F; L,F; L,F;..."

That I want to swich to "F,L; F,L; F,L;..."

Is there a way to do this?

Thanks a lot!!
 
OK, this is horribly unoptimized, but it's brute force and works. This will work with the string in cell A1 and will output the new string in cell A2

Sub Macro4()
'
' Macro4 Macro
Dim strInput As String, strOutput As String, lastTrim As String, firstTrim As String
Dim varZz As Variant
Dim i As Integer
Dim iLoop As Integer
strInput = Range("A1").Value
varZz = Split(strInput, ";")
iLoop = UBound(varZz)
Dim finalOutput As String
finalOutput = ""

For i = 0 To iLoop

lastTrim = Trim(Left(varZz(i), InStr(1, varZz(i), ",") - 1))
firstTrim = Trim(Right(varZz(i), Len(varZz(i)) - InStrRev(varZz(i), ",", -1)))
strOutput = firstTrim & ", " & lastTrim
finalOutput = finalOutput & "; " & strOutput

Next i
finalOutput = Right(finalOutput, Len(finalOutput) - 2)
Range("A2").Value = finalOutput

End Sub
 
The macro seems to have worked thank you very much armstrda! You've saved me hours of menial work.

Also thanks for the suggestion WildHorse.
 
Back
Top