+ Reply to Thread
Results 1 to 7 of 7

Next question not dislayed

  1. #1
    Registered User
    Join Date
    11-13-2003
    Location
    India
    MS-Off Ver
    2007
    Posts
    65

    Next question not dislayed

    I have created one quiz in which a set of 25 questions out of 50 questions , that can be varry as per our requirement.
    By generating unique random nos in sheet1 (A1:A25), one userform will be displayed 25 questions from set of 50 questions in Sheet2 will be displayed one by one by selecting "Next" button it will chioose the random no. in sheet1 serially one after one on till 25th and display 25 questions randomly and what ever answer is selected option will be stored in sheet2 next to the same question , where it can be totaled at the end and score can be sent by mail ,
    I am unable to loop next question one by one till end of all random nos. , Pl. check the code and help to resolve
    Attached Files Attached Files
    Last edited by amolryeolekar; 12-17-2012 at 01:49 AM.
    mast

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,748

    Re: question paper

    On quick read-through it looks like your problem is here:
    Please Login or Register  to view this content.
    The first time this sub is called, randomrow has not been initialized, so is 0. You have several lines of code (not included above) that refer to Cells at row "randomrow + 1", so those will refer to row 1.

    Then it sets x to 2, sets randomrow based on that. As we exit this Sub for the first time, randomrow will be the value of cell A2.

    The next time this is called, it updates the form, and then once again sets x to 2, sets randomrow based on that. So randomrow will always be the value of A2.

    (By the way, the last line of this Sub is useless because x is a local variable.)
    Last edited by 6StringJazzer; 12-13-2012 at 09:09 AM. Reason: cell reference is A2, not B1
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-13-2003
    Location
    India
    MS-Off Ver
    2007
    Posts
    65

    Re: question paper

    Can you pl.correct in code and revert

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,748

    Re: question paper

    I pointed out the error in your code. I don't have any idea what you're trying to do with x, so I think the fix is up to you.

  5. #5
    Registered User
    Join Date
    11-13-2003
    Location
    India
    MS-Off Ver
    2007
    Posts
    65

    Re: question paper

    How to store the last value in x as I want to use it next time when "Next" button pressed so that x can be called by adding previous value +1 so that i can scroll doewm from A1 to A2 , A3 .. A25 , any suggesion

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: question paper

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Registered User
    Join Date
    11-13-2003
    Location
    India
    MS-Off Ver
    2007
    Posts
    65

    [Solved]Next question not diaplayed

    Title changed

+ 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