+ Reply to Thread
Results 1 to 13 of 13

Create a 20 questions type of game using vba

  1. #1
    Registered User
    Join Date
    03-14-2014
    Location
    Missouri
    MS-Off Ver
    Excel 2003
    Posts
    13

    Create a 20 questions type of game using vba

    What I'm trying to do is create vba user interaction by asking the the user to answer a series of yes or no questions via input message boxes or yes or no buttons. For example, one question could be,"Is it cold outside?" If the user responded yes then the next question could be, " Is it snowing?" If no the next question could be, " Is it hot?". The possibilities are endless but I'm having trouble getting started. Any suggestions?

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Create a 20 questions type of game using vba

    You might want to look at creating a UserForm rather than a series of inputboxes. In addition you would use a "helper" worksheet which would house your question and answer tree path. With that being said what you want to accomplish is not for the novice. It sounds to me like an intermediate to advanced level project. Best of luck
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Create a 20 questions type of game using vba

    Random questions picked from a predefined possible list of questions?
    Sounds like a nice challenge. Have you decide how you want to record the given answers?
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  4. #4
    Registered User
    Join Date
    03-14-2014
    Location
    Missouri
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Create a 20 questions type of game using vba

    Not random questions, there will be a predefined starting question but the following questions will depend on the users yes or no answers. Every question and every answer will be predefined but by the series of yes and no answer the user will only see one of the answer.

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Create a 20 questions type of game using vba

    That will mean that only one question is show at the time and depending on the user's Yes / No the next question will be displayed?

    All you need is a userform with one label filed for the question and two option buttons for a Yes and a No.
    You will have to figure out the strategy for which question to show after every answer.

  6. #6
    Registered User
    Join Date
    03-14-2014
    Location
    Missouri
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Create a 20 questions type of game using vba

    I've thought about this for a few days and I can now better explain what I want to do with a working example of what I'm looking for:

    Please Login or Register  to view this content.
    My goal is to make many many questions, do you see a better way to do this or foresee any complications with this method?

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Create a 20 questions type of game using vba

    I don't forsee problems but it is quite static and any changes you would like to make in the future like adding questions or modifying question makes it difficult.

    I have an idea I will try to work out and then I'll post it to you.

    Just give me a day or two.

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

    Re: Create a 20 questions type of game using vba

    I would separate the data from the process, something like this:

    Row\Col
    A
    B
    1
    Response
    Question/Comment
    2
    Did it rain?
    3
    N Will you water the plants?
    4
    **NN Well, you should.
    5
    **NY Thank you.
    6
    Y More than an inch?
    7
    **YN More than a half inch?
    8
    ****YNN Give the plants a little snort
    9
    ****YNY Water the plants
    10
    **YY No need to water.


    (The asterisks are how indents appear on the board, and are there for readability; they are not asterisks or any other character.)

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Create a 20 questions type of game using vba

    Sorry that I haven't added any comments to the vba code but this is a little setup
    It's bed-time here, I'm just posting the file and off to bed.

    BTW, You could implement @shg 's idea about the YYY and YYNN etc. in this one too,
    Attached Files Attached Files

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Create a 20 questions type of game using vba

    Used shg's table and my form
    Attached Files Attached Files

  11. #11
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Create a 20 questions type of game using vba

    It works now, made a small mistake.
    Added a 2nd category
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    03-14-2014
    Location
    Missouri
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Create a 20 questions type of game using vba

    Thank you very much, I can see where this method will make a lot of difference once the number of questions become many. I appreciate your time, now I'm going to study the code to see if I can figure out how it works, I may have a few follow up questions.

  13. #13
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Create a 20 questions type of game using vba

    No problem, you know where to find us / me

+ 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. create game like from excel database
    By raj soni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2014, 02:44 AM
  2. Goal: Use Excel data to create a game schedule
    By MrRipley in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-13-2013, 06:50 PM
  3. create my own bingo game
    By pleasehelp in forum Excel General
    Replies: 10
    Last Post: 05-30-2012, 01:02 AM
  4. Replies: 1
    Last Post: 12-27-2009, 09:17 AM
  5. Create Lucky Draw game in Excel or PowerPoint
    By alibaba in forum Excel General
    Replies: 1
    Last Post: 10-23-2009, 01:16 AM
  6. Please help me create pop up questions
    By mward77095 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2006, 04:40 PM
  7. Game score without game being played
    By Sheila in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-17-2005, 07:06 PM

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