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?

  • 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 '09 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 '09 at 11:49
7

If the words are next to each other,

Turn on "Use Wildcards"

Find: (1stword) (2ndword)

Replace: \2 \1

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
  • This is the easiest way to do it. – alex Sep 7 '09 at 11:51
  • What the hardest way to do it? – Chris_45 Sep 7 '09 at 12:07
  • Modify each work by hand :). I can think of other ways... – alex Sep 7 '09 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 '09 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? :] – Kirill Strizhak Sep 8 '09 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.

-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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.