• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Creating objective type questions in excel using vba...

sn151

New Member
Hi all,

I have got an excel file which allows the users to take up objective type questions. A user form is used in this excel. There are 2 sheets. One displays the userform and the other sheets contains the questions and answers and this sheet will be hidden. The macro randomly chooses 10 questions and will display it to the user. The user will be able to view the next question only after he/she completes the first one and click next. After completing all the questions, once you hit next it shows a msg box with your score.

Now the problem is I want this score to be automatically transferred to another excel file with the users ID. And also the user should be able to take up the test only once. I am dont know the code for this. Please help me to solve this.....

Thanks in advance...
 

Attachments

  • Test1.xlsm
    27.5 KB · Views: 112
Hi, sn151!

Give a look at the uploaded files.

Usually I post the code here too but in this case is kinda messy so just the description:
- created file 2 (.xlsx) for holding the users table (Id, Name, Date, Result, Questions)
- replaced forms control button by ActiveX button for starting test
- created user form IdForm for validating user (id, name, password, once only test)
- rearranged all the code of QForm and Module1
- updated & saved file 2 when ending the test
- didn't used user form Submit (done automatically as of previous comment)
- file 2 name, all worksheets, all ranges, all constants, all... can be adjusted at top of each module

Just advise if any issue.

Regards!
 

Attachments

  • Creating objective type questions in excel using vba... - Test1 (for sn151 at chandoo.org).xlsm
    49 KB · Views: 177
  • Creating objective type questions in excel using vba... - Test2 (for sn151 at chandoo.org).xlsx
    11.9 KB · Views: 139
Hi SirJB7

Thank you so much for helping me. But still I get an error when I click GO. I have attached the screen shot for your reference. Please let me know how to proceed.

Thanks!
 
Hi SirJB7

Thank you so much for helping me. But still I get an error when I click GO. I have attached the screen shot for your reference. Please let me know how to proceed.

Thanks!
 

Attachments

  • Error.xlsx
    43.5 KB · Views: 47
Hi SirJB7,

Now the file is wrkng. Thank u so much for your help. I was holding this for a long time and at last with your help i was able to complete this. Once again thank u so much.... :)
 
How can I change the ID and password in the file 2?
When I try to change the ID and password it states ID doesn't exist. Help me pls....
 
Hi, sn151!

The error you were getting was due to that Excel couldn't find the file 2. I suggest you to do this:

1) Download both files to any folder and test them from there; if they work, then it should be you who adapted them wrong to your actual files.

2) Update the proper values to fit your actual parameters:
- file 2 name, all worksheets, all ranges, all constants, all... can be adjusted at top of each module
a) Workbook 2 name: module Module1
Public Const pgksUserWB = "Creating objective type questions in excel using vba... - Test2 (for sn151 at chandoo.org).xlsx"
b) Workbook 2 range names: user form IdForm, cmdGo_Click procedure
Const ksUserPath = ""
Const ksUserWS = "Users"
Const ksUserRange = "UserTable"
Note for user path: as you might have noticed reading the code:
- if Path="", same path of file 1 is assumed
- if Path contains a colon, Path is assumed to contain the full path to file 2
- otherwise Path contains a relative path (to subfolders) of file 1 path

Hope it helps.

Regards!
 
Hi, sn151!
Glad you solved it. Thanks for your feedback and for your kind words too. And welcome back whenever needed or wanted.
Regards!
 
Hi all,

I have got an excel file which allows the users to take up objective type questions. A user form is used in this excel. There are 2 sheets. One displays the user form and the other sheets contains the questions and answers and this sheet will be hidden. The macro randomly chooses 10 questions and will display it to the user. The user will be able to view the next question only after he/she completes the first one and click next. After completing all the questions, once you hit next it shows a msg box with your score.

Now the problem is
1) It is asking only 10 questions but i want to add few (200 to 300)more to question and answer sheet & then it should ask randomly 25 questions.
2) before starting exams it should ask User id & password
3) for each id it should assign test for only once
4) And at last it has to calculate the score out 100 percentage
5) And With time limit of 1 hour
So kindly solve my issues.

Thanking you in advance
 

Attachments

  • Question PaperV1.0 (1).xls
    59.5 KB · Views: 98
Now the problem is
1) It is asking only 10 questions but i want to add few (200 to 300)more to question and answer sheet & then it should ask randomly 25 questions.
2) before starting exams it should ask User id & password
3) for each id it should assign test for only once
4) And at last it has to calculate the score out 100 percentage
5) And With time limit of 1 hour
So kindly solve my issues.

Thanking you in advance
 
This is very useful one. i want change the ID, Name and Password format and length , how to change it. ID is allowed only 4 number characters and Password allowed only text.

Thanks in advance...
 
Back
Top