Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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?






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to copy the first word or two words from a cell containing a complete sentence to another cell jonny Excel Discussion (Misc queries) 7 May 19th 23 03:43 AM
How to make a long sentence wordwrap jbclem3 Excel Discussion (Misc queries) 1 October 31st 09 10:41 AM
In excel, how do we pull the first letter from words in a sentence Deepak Excel Worksheet Functions 7 February 4th 09 10:20 AM
Not all words in sentence prints - row is set autofit HELP? Marita Excel Worksheet Functions 0 January 14th 08 09:28 PM
How do I make Excel worksheet tabs change appearance when chosen . fentrkn Excel Discussion (Misc queries) 1 March 14th 05 05:36 PM


All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"