Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have found what appears to be a glitch in an application I have made. It is
an educational program designed to generate new questions for the student to practise each time a button is pressed. I have included a drop-down menu, named as "Question_Type" so that the student can set it to easy, medium or hard. I have attached some code to it in the sheet module so that if a value is selected from the drop-down, it will call the "New_Question" macro. This is contained in a separate module and includes a last line to select the "Answer" cell: (the second part of the worksheet_change code selects the "Answer" cell again when the student enters a value there so that if it was incorrect, they can have another go without needing to select that cell again) (In worksheet code) Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range Set rng = Range("Question_Type") If Not Intersect(rng, Target) Is Nothing Then Call New_Question End If Set rng = Range("Answer") If Not Intersect(rng, Target) Is Nothing Then Range("Answer").Select End If End Sub (In its own module) Sub New_Question() ActiveSheet.Calculate Range("Plotted_Q").Value = Range("Random_Q").Value Range("Answer").ClearContents Range("Show_Hide_Answer") = False Range("Answer").Select End Sub The glitch is that if you choose a difficulty level from the drop-down menu, it all goes fine and finishes by selecting the "Answer" cell, but when you start to type an answer, the text initially appears in the "Question_Type" drop-down cell instead. Only when you press enter does it then go into the "Answer" cell. Does anybody know how to correct this unusual behaviour? Many thanks in anticipation, Neil Goldwasser |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Counting text problem - formula works initially | Excel Worksheet Functions | |||
Selected Cell in a Range Appears in another Cell | Excel Worksheet Functions | |||
problem initially selecting a cell | Excel Discussion (Misc queries) | |||
Plus sign no longer appears when cell is selected | Excel Discussion (Misc queries) | |||
An image appears when a cell is selected | Excel Programming |