How to create random sentences out of a list of words

Lili_87

New Member
Joined
Nov 8, 2013
Messages
4
Hello

I need help with a macro which creates random sentences out of a list of words (I have a column with 2000 rows. Each cell contains 50-60 words). In each cell, I would like to create sentences - without meaning - for example one sentence contains 4 words, the next one 8, the next one 5...
Basically the words should be separated randomly by a dot, and after each dot the next word has to begin with a capital letter.

I want to create sentences only in that cell (between 7 - 15 words per sentence). The words are separated by spaces and comas (word1, word2,... ). I would like to remove the comas.
Let's say these are the words from the first cell:
word1, word2, word3, word4, word5, word6, word 7, word8, word9, word10, word11, word12, word13, word14

After I run the macro, I would like the cell to look like this:

Word1 word2 word3 word4 word5 word6. Word 7 word8 word9. Word10 word11 word12 word13 word14.

The dots should change the place randomly. If I run the macro again then I should have a new set of sentences:

Word1 word2 word3 word4 word5 word6 word 7 word8 word9. Word10 word11 word12 word13 word14.

and so on.

This thing should happen for each cell from the column. I don't want the cells to be identical. Let's say that after I run the macro, I would like to have 5 sentences in the first cell, in the second cell 10 sentences, in the third cell 13 sentences, in the fourth cell 8 sentences... as randomly as possible.

Any assistance you could provide would be really appreciated.

Kind Regards
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
first remove the commas by find "," replace with ""

counting the number of blanks in a cell and adding 1 gives you the number of words in the cell

so generate a random number between 3 and (number of words in cell minus 3)

if it is 7, find the 7th blank space and replace it with (full stop followed by blank)

get as far as this and somebody else will help you with capitalisation, I guess.
 
Upvote 0
Unfortunately I don't have much experience using <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: rgb(0, 0, 0); cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VBA</acronym> so if you could give me more details, that would be great. Thank you.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top