Forum Discussion
Setting IF function to speak a sentence
- Sep 05, 2019
No problem, please test it as per your convenience and let me know if that works for you as desired.
- mctribeiroSep 07, 2019Copper Contributor
Hi Subodh_Tiwari_sktneer . As I am new in this forum how do I mark in my post it has been solved?
- Subodh_Tiwari_sktneerSep 08, 2019Silver Contributor
Your question gets marked as Solved once you confirm any post as a Best Response and you have already done that though you chose the wrong one as Best Response as that post didn't contain any solution.
If a post is helpful you can hit the Like button for that post but the post which resolved your question by offering a solution should be confirmed as the Best Response.
Once a question is marked as Solved, you will observe a green triangle with a while tick mark like below...
Btw, I am also new to this forum. 🙂
- mctribeiroSep 05, 2019Copper Contributor
Subodh_Tiwari_sktneerhere I come again. I found out when the loop happens. The original sheet, with some cells which numbers come from another program via DDE, Dinamic Data Exchange, in real time the voice starts an endless loop when the condition is reached but in the sheet I sent you, with frozen cells, your program works perfectly (exception: if one the cells used in the formula turns to something else but a number the VBA bugs).
- Subodh_Tiwari_sktneerSep 05, 2019Silver Contributor
The code I proposed was supposed to work for a single cell A1.
In your sample file, are you looping through the column U and want the code to check the formula output for multiple cells in column U and then speak the text once a specific output is returned by the formula in one or more cells?
Since this is the Calculate event, each time Sheet is recalculated the code will be triggered and check the target cell/cells for the output returned by the formula and if that meets the criteria, the code will invoke the speech method and to handle this scenario, you can place a flag once the text is spoken for a cell either by using a helper column and placing a flag in there or you can change the cell color so that the code can check before speaking the text if the cell color is not a specific color i.e. once the code speaks the text for a cell, change the cell color to say Red and the next time code will check the cell color and if it is red, it will skip and won't speak the text for the same cell again.
As far as the VBA errors are concerned when the value is not numeric, I think the code will produce an error if the cell has an error in it which you can easily check in the code with an IF condition like If Not IsError(Range("A1")) Then.
- mctribeiroSep 05, 2019Copper Contributor
Subodh_Tiwari_sktneermy idea is to write an specific sentence for each cell in column "U" as each line refers to a different information. How can write a formula that consider it or is it to complicate?