+ Reply to Thread
Results 1 to 28 of 28

MsgBox Random Title Generator

Hybrid View

  1. #1
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: MsgBox Random Title Generator

    MsgBox "This function has already been performed", vbExclamation, RandTitle
    Function RandTitle() As String
      Static avsTitle As Variant
      
      If IsEmpty(avsTitle) Then avsTitle = Split("Darn,Drat,EGAD!,Holy Cow!,Shoot!,Not so fast!,Oops!,Slow down!,That won't work", ",")
      RandTitle = avsTitle(Int(Rnd() * UBound(avsTitle) + 1))
    End Function
    Entia non sunt multiplicanda sine necessitate

  2. #2
    Registered User
    Join Date
    08-07-2015
    Location
    Washington
    MS-Off Ver
    365, v1808 32bit
    Posts
    59

    Re: MsgBox Random Title Generator

    Thanks @shg! I had an idea in my mind, but wasn't sure how to actually make this work. I haven't really played with Functions before.

    Your code seems to work great, however... I put my own title words in the split (14 total so far) and tested this out for 5 solid minutes. All words showed up on my msgboxes, except the first word in the list. To experiment, I changed the + 1 at the end of the code to a + 0 to see what would happen, and with a second test, all words showed up except the last word in the list now. So was wondering what that + 1 (or +0) actually does and if there's a way to reassure all words in my list will appear at some point?

    Thanks again for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 06-21-2013, 10:40 AM
  2. Random Name Generator
    By jsbryan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-13-2012, 10:44 AM
  3. [SOLVED] random generator
    By arn2025 in forum Excel General
    Replies: 4
    Last Post: 04-04-2012, 06:22 AM
  4. random generator
    By arn2025 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2012, 04:17 AM
  5. VBA Random Generator
    By switm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2011, 02:22 PM
  6. random name generator
    By SRussell in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-25-2007, 06:28 PM
  7. Random Name Generator
    By Smeeg in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-03-2006, 11:30 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1