![]() |
make a sentence from words chosen at random
A1:A10 contains prepositions
B1:B10 contains adjectives C1:C10 contains nouns D1:D10 contains verbs Can I have a macro select one item at random from each range? |
make a sentence from words chosen at random
Hi DL,
This should help you: Sub GenerateSentence() Dim WordNumber As Integer Dim Sentence As String Dim c As Integer For c = 1 To 4 Randomize WordNumber = Int((10 * Rnd) + 1) Sentence = Sentence & Cells(WordNumber, c) & " " Next c MsgBox Sentence End Sub ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 12:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com