Tradu articolul în română (Google Translate)

Note: The article below has been written more than a year ago!

Word macro to convert from a vertical list to a horizontal list (separated by comma)

Note – I am not responsible for any problems that may arise from using a macro!

Let’s say you have a list:

word1

word2

word3

You need to convert this into:

word1, word2, word3

Sure, it’s not hard to do it just one time. But what happens if you need this on a regular basis?

I’ve created a Microsoft Word macro that helps with that.

You have an empty document looking like this:

word1

word2

word3

It will convert this into:

word1, word2, word3

In the end, after you run it, it cuts the data, all you need is to paste.

How to install a Macro for Word? Details #1 ». Details #2.

Sub Din_Enter_in_virgula_Din_Lista_Verticala_in_Lista_Orizontala()

‘ Macro1 Macro


Selection.WholeStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = „^p”
.Replacement.Text = „, ”
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Selection.WholeStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = „, ^p”
.Replacement.Text = „”
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Cut

End Sub

You can add a macro to quick launch in Word, and this is how to install macros in Word.

michael szpakowski - list
michael szpakowski – list, https://flic.kr/p/2j9xxV8

Last modified on: 2021.10.30, at: 10:44.

Share on WhatsApp

Lasă un comentariu

Rules for commenters »

Puteți folosi Gravatar pentru a adăuga avatar (imagine comentarii).

Acest site folosește Akismet pentru a reduce spamul. Află cum sunt procesate datele comentariilor tale.