If I have a Word-document and want 2 words next to each other to change places with oneanother is that possible with some function or logic in Word?
If the words are next to each other,
Turn on "Use Wildcards"
Find: (1stword) (2ndword)
Replace: \2 \1
Not sure I understand your question but you can use search and replace like this:
- Replace the first word with something random
- Replace the second word with the first word
- Replace the random word with the second word
If you want some VBA to swap two adjacent words around, this will do it:
Sub SwapWords() 'Clear Selection Selection.SetRange Start:=Selection.Start, End:=Selection.Start 'Expand Selection to word under cursor Selection.Expand 'Cut word Selection.Cut 'Move one word right Selection.MoveRight Unit:=wdWord 'Paste word Selection.Paste End Sub
Random words are not needed if you have two exact word separated by a single space (or some similar CONSISTENT layout)
Use Find and replace to search for word1 word2 and replace with word2 word1
I have just discovered myself, this is easiest done in Microsoft Excel:
- Open an Excel workbook and paste the data to be "swapped" into the spreadsheet.
- First thing is to make sure you have a blank column next to where the split will happen, so insert columns as necessary.
- Highlight the column that you want to separate.
- From the Data Group tab, select Text to Columns, the "Convert Text to Columns Wizard" will open up.
- Excel will determine the Original Data Type for you (if each set of data has the same number of characters, fixed will be selected. If not, delimited will be.) Click next
- If your current data is separated by one of the Delimiters listed (normally space), select that and click next.
- Select the type of Column Data Format (text, number, etc.), click finish.
- It may ask you if you want to replace the contents of the destination cells-click "ok"
If you don't want to leave it in an Excel Spreadsheet, you can copy and paste (either as text or table) into a Word document.
- Highlight the word with left click.
- Hold down right click and move the cursor where you want the word to go.
- Let go.