Excel should speak results of logical formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like to create a logical formula i.e. if X = Y, "A","B", and have excel
speak the result. Any ideas ?

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...dg=microsoft.public.excel.worksheet.functions
 
If
=IF(X=Y,"A","B")
is not what you want, then try explaining in much greater detail.

Jerry
 
Jerry

I'm trying to teach my son times tables. If he types in the correct answer I
would like excel to say "Correct" or "Try Again" if he gets it wrong. Hence
the use of logic formula to generate the phrase. However while Excel will
speak the number he types in (once he presses return), it will not speak the
phrase generated by the logical formula. I wondered if there was a function
to place in the logic formula to make Excel speak the result. Hope ths
clarifies.
 
Hi TH. Here's a slightly different idea then a regular worksheet function.
This simple demo has you place your numbers in the top row, and first
column.
Place this code on the worksheet module.
Then, you fill in the table as a multiplication table.
I threw in a Mod function to occasionally change the "correct" result.
Adjust sayings to your preferences.
HTH. :>)

Option Explicit
Public Say As Speech ' <-- Make sure

Private Sub Worksheet_Change(ByVal Target As Range)
'= = = = = = = = = = = = = =
'// Place code on the sheet module
'// If your table of numbers is in the top row,
'// and left column, fill in the table
'// with the multiplication values.
'// Excel will speak the results.
'// Adjust sayings to what you would like.
'// By: Dana DeLouis
'= = = = = = = = = = = = = =

Dim R As Long
Dim C As Long

If Say Is Nothing Then Set Say = Application.Speech
R = Target.Row
C = Target.Column

'// Limit your range here...
If R = 1 Or C = 1 Then Exit Sub


Select Case Cells(R, 1) * Cells(1, C) = Target.Value
Case True
If Round(Rnd * 3) = 0 Then
Say.Speak "Excellent, John", True
Else
Say.Speak "Correct", True
End If
Case False
Say.Speak "Incorrect, please try again", True
End Select
End Sub
 
Well, I've never tried it like a function along the lines that you want to
use it.
Looks like it works just fine. So, perhaps a more simple version...
You can place this on a regular module sheet...

Function Check(X, Y)
If X = Y Then
Application.Speech.Speak "Correct", True
Else
Application.Speech.Speak "Try Again", True
End If
End Function

On a worksheet...
=Check(A1,B1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top