Try Counting

armando

Board Regular
Hi! I have a kid working in a sheet with a column list of words in his native language. He has to write the correct word in English in a second column. In a third column he will get a message "Well done" or "Try Again" (with IF formula ...). Is it possible to let him work on 20 words (for example) and then having counted the number of times he tried to write the list of words correctly?. Maybe counting the number of times the "Enter" key was pressed?. Then if the number of tries was below a preset number (25 or 30...) he finished the homework?.

Regards and Thanks for your help!.

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
The Worksheet_Change event procedure fires when the user changes a value in a cell, so you can use that to count the number of times Enter is pressed. Here is an example:

Code:
``````Private Sub Worksheet_Change(ByVal Target As Range)
Static Counter As Integer
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("B1:B20")) Is Nothing Then Exit Sub
If IsEmpty(Counter) Then
Counter = 1
Else
Counter = Counter + 1
End If
MsgBox Counter
End Sub``````

I would suggest adding this change to Andrew's code

Code:
``````Private Sub Worksheet_Change(ByVal Target As Range)
Static Counter As Integer
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("B1:B20")) Is Nothing Then Exit Sub

If Intersect(Target, Range("b1:b20")).Value = vbNullString Then Exit Sub

If IsEmpty(Counter) Then
Counter = 1
Else
Counter = Counter + 1
End If
MsgBox Counter
End Sub``````

This will negate the count of worksheet change in that range where the incorrect answer is being cleared.

TryingToLearn said:
I would suggest adding this change to Andrew's code

Code:
``````Private Sub Worksheet_Change(ByVal Target As Range)
Static Counter As Integer
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("B1:B20")) Is Nothing Then Exit Sub

If Intersect(Target, Range("b1:b20")).Value = vbNullString Then Exit Sub

If IsEmpty(Counter) Then
Counter = 1
Else
Counter = Counter + 1
End If
MsgBox Counter
End Sub``````

This will negate the count of worksheet change in that range where the incorrect answer is being cleared.

That's a good idea. Presumably you've been testing it in a "real world" scenario.

I was just thinking like a kid learning something new (not hard for me to do!). First thing I'm going to do if I make a mistake is to delete it before anyone sees it!!!!!!!

Replies
0
Views
189
Replies
1
Views
176
Replies
4
Views
519
Replies
0
Views
182
Replies
0
Views
191

1,203,326
Messages
6,054,745
Members
444,748
Latest member
knowak87

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back