Swap words next to each other in Word?

14,952

Solution 1

If the words are next to each other,

Turn on "Use Wildcards"

Find: (1stword) (2ndword)

Replace: \2 \1

Solution 2

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

Solution 3

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

Solution 4

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

Share:
14,952
Chris_45
Author by

Chris_45

Updated on September 17, 2022

Comments

  • Chris_45
    Chris_45 almost 2 years

    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?

    • Snark
      Snark almost 15 years
      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? ...
    • Chris_45
      Chris_45 almost 15 years
      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?
  • alex
    alex almost 15 years
    This is the easiest way to do it.
  • Chris_45
    Chris_45 almost 15 years
    What the hardest way to do it?
  • alex
    alex almost 15 years
    Modify each work by hand :). I can think of other ways...
  • Chris_45
    Chris_45 almost 15 years
    But what if they are not next to each other?
  • Bonus
    Bonus almost 15 years
    You'd need to be better at formulating regular expressions than I am. This might help office.microsoft.com/en-gb/word/HA010873041033.aspx
  • Kirill Strizhak
    Kirill Strizhak almost 15 years
    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? :]
  • Chris_45
    Chris_45 almost 15 years
    This is ok when they are as you say next to each other. Thanks.
  • DarkDiamond
    DarkDiamond over 2 years
    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