Make Excel Cells Speak Numbers and Text on Mac

Posted on

Excel for Mac has a powerful but often overlooked feature: text-to-speech using macOS’s built-in say command. This tutorial will show you how to make Excel automatically read cell values aloud when you click them, perfect for data verification, accessibility, or learning purposes.

What You’ll Learn

  • Auto-read numbers when clicking cells
  • Switch between Indonesian and English voices
  • Read both numbers and text content
  • Customize speech speed and voice

Prerequisites

  • Excel for Mac (any recent version)
  • macOS with Indonesian voice “Damayanti” installed (or use any English voice like “Samantha”)
  • Basic familiarity with Excel VBA

Method 1: Reading Numbers Only (Indonesian Voice)

This is perfect for reading numeric data like prices, measurements, or scores.

Step-by-Step Instructions

  1. Open Excel and go to your worksheet
  2. Press Alt+F11 (or Fn+Option+F11) to open VBA Editor
  3. In the left panel, double-click your sheet name (e.g., “Sheet1”)
  4. Paste this code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error Resume Next
    
    ' Only process single cell
    If Target.Cells.Count > 1 Then Exit Sub
    
    Dim txt As String
    txt = CStr(Target.Value)
    If txt = "" Then Exit Sub
    
    ' Replace period with "koma" (comma in Indonesian)
    txt = Replace(txt, ".", " koma ")
    
    ' Stop any previous speech
    Call MacScript("do shell script ""killall say 2>/dev/null || true""")
    
    ' Small delay to ensure kill command completes
    Application.Wait Now + TimeValue("00:00:00.04")
    
    ' Build and execute say command
    Dim cmd As String
    cmd = "do shell script ""say -v Damayanti -r 310 " & Chr(39) & txt & Chr(39) & " &"""
    
    Call MacScript(cmd)
End Sub
  1. Close VBA Editor (press Cmd+Q or click the red X)
  2. Test it: Click on a cell with a number like 3.4

How It Works

  • 3.4 → speaks “tiga koma empat” (three point four in Indonesian)
  • 100 → speaks “seratus” (one hundred)
  • 12.567 → speaks “dua belas koma lima enam tujuh”

Voice Settings Explained

  • -v Damayanti: Indonesian female voice
  • -r 310: Speech rate (200-400 range; 310 is moderate speed)
  • & at end: Runs in background so Excel doesn’t freeze

Method 2: Reading Numbers (English Voice)

Want to hear numbers in English? Just change the voice!

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error Resume Next
    
    If Target.Cells.Count > 1 Then Exit Sub
    
    Dim txt As String
    txt = CStr(Target.Value)
    If txt = "" Then Exit Sub
    
    ' Replace period with "point" for English
    txt = Replace(txt, ".", " point ")
    
    Call MacScript("do shell script ""killall say 2>/dev/null || true""")
    Application.Wait Now + TimeValue("00:00:00.04")
    
    Dim cmd As String
    ' Using Samantha (English US female voice)
    cmd = "do shell script ""say -v Samantha -r 280 " & Chr(39) & txt & Chr(39) & " &"""
    
    Call MacScript(cmd)
End Sub

Popular English Voices

  • Samantha: US English female (default)
  • Alex: US English male
  • Daniel: UK English male
  • Karen: Australian English female

Method 3: Reading Both Numbers AND Text (Full Solution)

This advanced version reads everything: numbers, text, formulas results, and mixed content.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error Resume Next
    
    ' Only process single cell
    If Target.Cells.Count > 1 Then Exit Sub
    
    Dim txt As String
    txt = CStr(Target.Value)
    If txt = "" Then Exit Sub
    
    ' Determine if content is numeric or text
    Dim isNumeric As Boolean
    isNumeric = IsNumeric(Target.Value)
    
    ' Format based on content type
    If isNumeric Then
        ' For numbers: replace period with "koma" (Indonesian) or "point" (English)
        txt = Replace(txt, ".", " koma ")
    Else
        ' For text: clean up quotes and special characters
        txt = Replace(txt, Chr(34), "'")  ' Replace double quotes
        txt = Replace(txt, """", "'")
    End If
    
    ' Stop any previous speech
    Call MacScript("do shell script ""killall say 2>/dev/null || true""")
    
    ' Small delay
    Application.Wait Now + TimeValue("00:00:00.04")
    
    ' Voice settings
    Dim voice As String
    Dim rate As Long
    
    ' Choose voice based on content type
    If isNumeric Then
        voice = "Damayanti"  ' Indonesian for numbers
        rate = 310
    Else
        voice = "Samantha"   ' English for text
        rate = 280
    End If
    
    ' Build and execute command
    Dim cmd As String
    cmd = "do shell script ""say -v " & voice & " -r " & CStr(rate) & " " & Chr(39) & txt & Chr(39) & " &"""
    
    Call MacScript(cmd)
End Sub

What This Does

  • Numbers (3.4, 100, 0.5) → Read in Indonesian with Damayanti
  • Text (“Hello”, “Product A”) → Read in English with Samantha
  • Mixed → Automatically detects and uses appropriate voice

Method 4: Advanced – Text Preprocessing for Better Speech

For better pronunciation of complex text:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error Resume Next
    
    If Target.Cells.Count > 1 Then Exit Sub
    
    Dim txt As String
    txt = CStr(Target.Value)
    If txt = "" Then Exit Sub
    
    ' Advanced text preprocessing
    txt = PreprocessText(txt)
    
    ' Stop previous speech
    Call MacScript("do shell script ""killall say 2>/dev/null || true""")
    Application.Wait Now + TimeValue("00:00:00.04")
    
    ' Execute speech
    Dim cmd As String
    cmd = "do shell script ""say -v Samantha -r 280 " & Chr(39) & txt & Chr(39) & " &"""
    Call MacScript(cmd)
End Sub

Function PreprocessText(txt As String) As String
    ' Replace common abbreviations and symbols
    txt = Replace(txt, "&", " and ")
    txt = Replace(txt, "@", " at ")
    txt = Replace(txt, "#", " number ")
    txt = Replace(txt, "%", " percent ")
    txt = Replace(txt, "$", " dollars ")
    txt = Replace(txt, "€", " euros ")
    txt = Replace(txt, "£", " pounds ")
    
    ' Replace periods in decimals
    If IsNumeric(txt) Then
        txt = Replace(txt, ".", " point ")
    End If
    
    ' Clean up quotes
    txt = Replace(txt, Chr(34), "'")
    txt = Replace(txt, """", "'")
    
    ' Remove multiple spaces
    Do While InStr(txt, "  ") > 0
        txt = Replace(txt, "  ", " ")
    Loop
    
    PreprocessText = Trim(txt)
End Function

Examples with Preprocessing

  • Price: $19.99 → “Price colon nineteen dollars and ninety nine cents”
  • Email@domain.com → “Email at domain dot com”
  • 50% → “fifty percent”
  • #123 → “number one hundred twenty three”

Customization Options

1. Change Speech Speed

rate = 200  ' Very slow
rate = 280  ' Normal
rate = 350  ' Fast
rate = 400  ' Very fast

2. Available Voices

Check all installed voices in Terminal:

say -v ?

Indonesian Voices:

  • Damayanti (female)

English Voices:

  • Samantha (US, female)
  • Alex (US, male)
  • Daniel (UK, male)
  • Karen (Australian, female)
  • Moira (Irish, female)

3. Voice-Specific Settings

' For Indonesian
voice = "Damayanti"
rate = 310

' For English US
voice = "Samantha"
rate = 280

' For English UK
voice = "Daniel"
rate = 260

' For faster speech (any voice)
rate = 380

Troubleshooting

Problem: No sound when clicking cells

Solution:

  1. Check System Preferences → Sound → Output is not muted
  2. Test voice in Terminal: say -v Damayanti "test"
  3. Make sure Damayanti is installed (System Preferences → Accessibility → Spoken Content → System Voice → Manage Voices)

Problem: Voice not found error

Solution: Install the voice:

  1. System Preferences → Accessibility → Spoken Content
  2. Click “System Voice” → Customize
  3. Download “Damayanti – Indonesian” or other voices

Problem: Code doesn’t work

Solution:

  1. Make sure code is in Sheet module (not a regular Module)
  2. Check macros are enabled: Excel → Preferences → Security & Privacy → Enable all macros
  3. Save workbook as .xlsm (macro-enabled)

Problem: Clicking same cell twice doesn’t speak

Limitation: Excel’s SelectionChange event only triggers when moving to a different cell. To hear the same cell again:

  • Click another cell first, then click back
  • Or use a button/keyboard shortcut (see advanced section below)

You now have a powerful, hands-free way to verify Excel data! Whether you’re checking financial figures, reviewing inventory numbers, or making your spreadsheets more accessible, text-to-speech is a game-changer.

Remember: Excel’s limitation means clicking the same cell twice won’t trigger speech again. You must click another cell first, or use the button method if repeated playback is essential.