Really odd. I copied your line, but I'm using my variable which is a double and it changes the word Format to format and then doesn't compile. Here is my code...

Option Explicit

Private Declare PtrSafe Function timeGetTime Lib "winmm.dll" () As Long
Sub Timer()
   
Dim started As Long
Dim ended   As Long
Dim i       As Long
Dim s       As Double
Dim m       As Long
Dim h       As Long
Dim format  As Boolean

h = 0
m = 0
format = True
started = timeGetTime ' Get milliseconds since startup
    For i = 1 To 100
        Cells(1, 1) = 4
    Next
ended = timeGetTime

'If format is true, display results using h m s.xxx otherwise display as ms
s = ended - started
If format Then
    If s >= 3600000 Then
        h = s / 3600000
        m = (s Mod 3600000) / 60000
        s = (s Mod 3600000) Mod 6000
        s = s / 1000
    ElseIf s >= 60000 Then
        m = s / 60000
        s = s Mod 60000
        s = s / 1000
    Else
        s = s / 1000
    End If
    
    'Debug.Print "Time Taken = " & h & "h " & m & "m " & s & "s"
    Debug.Print "The number is " & format(s, "#.000")
Else
    Debug.Print "Time Taken = " & s & "ms"
End If


End Sub