Sure thing!
Here's the code:
Sub explodelist()
'
' explodelist Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ", "
.Replacement.Text = "^n"
.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.Cut
End Sub
What this does is, I take a list of ingredients seperated by commas and paste it into word. When I run the macro, the program does [find and replace to replace each instance of a comma followed by a space (, ) with a page break (^n). Then it selects all and cuts it onto the clipboard] so I can paste it into excel, where it appears in seperate cells within a column rather than the whole list in paragraph form, which is how it started.
The brackets surround my description of exactly what the macro does. My main goal for this is to be able to acomplish the same thing without having to be clicking back and forth between windows all the time.
|