PDA

View Full Version : Randomize words within a Sentence.



Seatonian
03-15-2014, 08:37 AM
Dear Friends, Can you help please? I'm trying to assist an overseas student who needs exercises of the type produced by this Macro. I can enviseage it but I cannot code it. It will act upon up to 20 sentences max, displayed in a list and all selected, about 15 words max length. It will change the order of the words and reprint them on a Worksheet.

The Macro should do the following:

Temp remove the final period (full stop).
Convert the initial Capital to lower case ONLY IF it is underlined.
Test for groups of words enclosed between square brackets. They are to be treated as one word while sorting & printing, the brackets remaining in place afterwards.
Read each sentence in turn and divide into separate words.
Assign the words to elements of an array.
Sort the array using a random number routine (no repetition).
Print out the randomised sentence on the same document (ie Below the Selection) and in the same order as the originals. (Tapered difficulty!)
Restore the final period (full stop) at end of randomized sentence.
Print a horizontal line under each rand. sentence (full width of page.)
Repeat from Step 4 for each sentence.
On exit, leave both sets of Sentences displayed to allow for checking then manual deletion of originals.

Thank you very much in advance. I'm sorry that my knowledge of Arrays & sorting is virtually zero, but I need the Macro very urgently.
Thanks again.
Seatonian.