Useful Hacks, Reviews, Tips and Tricks of anything under the moon and the sun.

How to Transpose Two Words in MS Word

No comments
Last week, HR forwared me a list of employees which has the following format

Firstname + (space) + Lastname


The document is to exported to our Customer Relation Management System (CRM) but my problem is it should on the following format.

LastName + (space) + Firstname

So to make my life easier, I have to transpose each name to the new format. I did it using a Macro.


To transpose two words follow these steps:

1. Open you Word document.
2. Go to Tools > Macro > Visual Basic Editor
3. Add the following codes on the VBA editor

Sub Transpose()
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Cut
Selection.MoveRight Unit:=wdWord, Count:=1
Selection.Paste
Selection.MoveLeft Unit:=wdWord, Count:=1
End Sub


4. Now go back at your document, then put your cursor between the word you want to transpose.
5. Press [ALT]+[F8] and when the macro dialog box appears, just press [enter].

How to Transpose Two Words in MS Word

No comments :

Post a Comment