Macro to select last cell in row and start Text to Speech

JMDR

New Member
Joined
Dec 12, 2012
Messages
3
I would like to have a macro (that I can assign to a button) to select the last cell in the row of the currently selected cell (there may or may not be blank cells in the row), then activate the Text to Speech feature to read the contents of the cell, and then have it continue to the next row down until it comes to the end of the column (or until stopped by the user).

Why? I'm creating a data entry template, and the last cell in each row has a concatenation formula to read back the data in an intelligible manner. I want to lock the worksheet to prevent any changes other than entering validated data into the necessary cells. I also want to make it very obvious (i.e. a big button to press) for the people entering the data to activate the Speech feature.

I'm pretty experienced using Excel, but less so VBA (but I don't mind tweaking the code). I've tried a bunch of things myself, but have not had any success so far. Any tips in the right direction would be appreciated.

(Excel 2010, in Windows 7)
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Sub tts()
Cells(ActiveCell.Row, 16384).End(xlToLeft).Select
Doit:
Application.Speech.Speak Selection.Value
Selection.Offset(1).Select
If Len(Selection.Value) > 0 Then GoTo Doit
End Sub
 
Upvote 0
Awesome, worked perfect. Many thanks.

The one little "bug" is that if I press [Esc] to stop the text-to-speech, Excel throws a VBA run-time error '287' and the debugger (which I think will scare my data enter-ers ;)). Is there a way to prevent that from happening?
 
Upvote 0
THis worked for me...

Code:
Sub tts()
On Error GoTo ErrHandler
 Cells(ActiveCell.Row, Columns.Count).End(xlToLeft).Select
Doit:

 Application.Speech.Speak Selection.Value
 Selection.Offset(1).Select
 Cells(ActiveCell.Row, Columns.Count).End(xlToLeft).Select
 If Len(Selection.Value) > 0 Then GoTo Doit
Exit Sub
ErrHandler:
 Application.SendKeys "^{Break}"
 End Sub
 
Upvote 0

Forum statistics

Threads
1,215,487
Messages
6,125,073
Members
449,205
Latest member
Healthydogs

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top