2

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?

2
  • As I guess it's not as simple as "cut word A, move to word B, paste word A, cut word B, move to former position of word A, paste word B", can you be more specific? Do you want to do this in a macro? In the "search and replace" dialog? With 1 command and the 2 words selected? ...
    – Snark
    Sep 7, 2009 at 11:37
  • I wonder how smart Word is, thats the default action with cut etc..but I wonder if there is some swapfunction in Word, I know there are functions for Word if you have a table with FALSE, NOT OR and so on but I havent found any functions "outside a table", but is there?
    – Chris_45
    Sep 7, 2009 at 11:49

7 Answers 7

7

If the words are next to each other,

Turn on "Use Wildcards"

Find: (1stword) (2ndword)

Replace: \2 \1

3
8

Not sure I understand your question but you can use search and replace like this:

  1. Replace the first word with something random
  2. Replace the second word with the first word
  3. Replace the random word with the second word
5
  • This is the easiest way to do it.
    – alex
    Sep 7, 2009 at 11:51
  • What the hardest way to do it?
    – Chris_45
    Sep 7, 2009 at 12:07
  • Modify each work by hand :). I can think of other ways...
    – alex
    Sep 7, 2009 at 12:11
  • 1
    There is no hardest way, I assure you. I can think of infinitely hard ways to do it.
    – waiwai933
    Sep 7, 2009 at 12:29
  • 1
    And why do you need the hardest way in the first place? Like, you have an easy life without any problems and you are bored, so you start making up problems to spice up your life? :) Well, I dunno, join the army? Or jump off a plane with a parachute? :] Sep 8, 2009 at 10:50
4

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
1

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

0

I have just discovered myself, this is easiest done in Microsoft Excel:

  1. Open an Excel workbook and paste the data to be "swapped" into the spreadsheet.
  2. First thing is to make sure you have a blank column next to where the split will happen, so insert columns as necessary.
  3. Highlight the column that you want to separate.
  4. From the Data Group tab, select Text to Columns, the "Convert Text to Columns Wizard" will open up.
  5. 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
  6. If your current data is separated by one of the Delimiters listed (normally space), select that and click next.
  7. Select the type of Column Data Format (text, number, etc.), click finish.
  8. 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.

0

I think I saw someone do this with QuarkXpress. He made 2 selections and executed some keyboard shortcut, and hey presto, the two selections swapped positions. So "wishing you good health and happiness" became "wishing you happiness and good health". It took barely two seconds. You often need to do this or something similar when you're editing. Without a 'swap' function, it's quite a fiddle. It would be useful to be able to swap the contents of two cells instantly in Excel too. Or swap the positions of paragraphs 2 and 7 with a single command.

1
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review Nov 24, 2021 at 13:32
-1
  1. Highlight the word with left click.
  2. Hold down right click and move the cursor where you want the word to go.
  3. Let go.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .