+ Reply to Thread
Results 1 to 13 of 13

Database for flashcard-style learning

  1. #1
    Registered User
    Join Date
    05-23-2011
    Location
    Volkan
    MS-Off Ver
    Excel 2003
    Posts
    12

    Post Database for flashcard-style learning

    Hi All,

    I'm building a database for learning purposes. The structure is pretty simple. Column A contains all the questions, and Column B contains all the answers. Example:
    Q: What is the capital of Nepal? A: Kathmandu.

    I need a solution to display a random question in a message box (or in any other appropriate way, like in a cell of another worksheet), then, after clicking 'OK', display the answer in a new message box (or in any other appropriate way). Any help or pointers would be appreciated. In your response however, please refrain from posting urls, unless it specifically gives a viable solution to the aforementioned problem.

    Thanks in advance.
    Last edited by Volkanismo; 05-24-2011 at 09:17 AM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Database for flashcard-style learning

    Hi, Welcome to the Forum!

    This code will display a random question. You need to put your sheet name where it says "Your Sheet Name".

    Please Login or Register  to view this content.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    05-23-2011
    Location
    Volkan
    MS-Off Ver
    Excel 2003
    Posts
    12

    Post Re: Database for flashcard-style learning

    Quote Originally Posted by davegugg View Post
    Hi, Welcome to the Forum!

    This code will display a random question. You need to put your sheet name where it says "Your Sheet Name".
    Thanks very much, davegugg! You're awesome. *solved*

    Any idea how to elminate the beeping?

    Also, it would be nice to include a "Did you know the answer?" in the answer message box with a "Yes" and "No" button, and summarize the results in the spreadsheet.
    Last edited by Volkanismo; 05-23-2011 at 11:01 AM.

  4. #4
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Database for flashcard-style learning

    How about this?

    The code in the attached workbook is as follows:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-23-2011
    Location
    Volkan
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Database for flashcard-style learning

    Thanks! Great! I will surely utilize this formula.

    The problem is, my answers are a tad too long to correctly answer them every time (as even if a letter is misspelled, you're wrong all the time). I was thinking of a solution where you don't input any text for an answer, just check the answer and honestly give a feedback with a Yes or No button, whether you were correct or not, and the macro summarizes your results.

  6. #6
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Database for flashcard-style learning

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-23-2011
    Location
    Volkan
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Database for flashcard-style learning

    Quote Originally Posted by davegugg View Post
    Please Login or Register  to view this content.
    Great, thanks! It works until I click 'Yes', after which I get an error message: Runtime error '13'. Type mismatch. And when I click debug, it highlights the following row:
    .Cells(1, 3).Value = .Cells(1, 3).Value + 1

  8. #8
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Database for flashcard-style learning

    Do you already have data in cells C1 and D1 of the sheet with the q's and a's? You can change the targets to empty, unused cells.

  9. #9
    Registered User
    Join Date
    05-23-2011
    Location
    Volkan
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Database for flashcard-style learning

    Quote Originally Posted by davegugg View Post
    Do you already have data in cells C1 and D1 of the sheet with the q's and a's? You can change the targets to empty, unused cells.
    Oh, okay, stupid me, thanks. Now just one more question (if I may): how do I tell the macro to ask me more questions until I hit 'Esc' and then summarize how many correct answers I got out of how many questions?

  10. #10
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Database for flashcard-style learning

    Something like this:
    Please Login or Register  to view this content.
    If I use Davegugg's code, then it would be
    Please Login or Register  to view this content.
    Last edited by Whizbang; 05-23-2011 at 02:53 PM.

  11. #11
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Database for flashcard-style learning

    I'd suggest just a few changes from what Whizbang last proposed:

    Please Login or Register  to view this content.
    By using a do...loop until loop you can cut down on the amount of message boxes. Also, save the final score messagebox for the end of the procedure. Also, I'd combine the answer messagebox with the question of whether you got it right. Lastly, no need to code lines to define the two long variables twice - just define them once inside the loop.

  12. #12
    Registered User
    Join Date
    05-23-2011
    Location
    Volkan
    MS-Off Ver
    Excel 2003
    Posts
    12

    Post Re: Database for flashcard-style learning

    Quote Originally Posted by davegugg View Post
    I'd suggest just a few changes from what Whizbang last proposed:
    By using a do...loop until loop you can cut down on the amount of message boxes. Also, save the final score messagebox for the end of the procedure. Also, I'd combine the answer messagebox with the question of whether you got it right. Lastly, no need to code lines to define the two long variables twice - just define them once inside the loop.
    Excellent! Thanks much! Now just (really and hopefully ) the last tweak:
    - how do I display the results in a different worksheet say "Sheet2"?
    - reset the displayed results every time I run the macro?

    Sorry for the noob questions, but this is my very first macro.

  13. #13
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Database for flashcard-style learning

    I'd add the header "Questions answered correctly" to Cell A1 on Sheet 2 and "Questions anwered incorrectly" to Cell B1 on Sheet 2. This code should be in its own module.

    Please Login or Register  to view this content.
    Don't worry about asking too many questions, everyone starts somewhere ; )
    Just be sure to look at how the changes in the code affected the final product.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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