I added a doevents command in the do-while loop, but that still didn't work because it stopped anytime cell(1,1) got changed...the only way I think you can get this to work is sort of convoluted: you need use the ontime command. First I added a command button, and added this to its click event:
Private Sub CommandButton1_Click()
If Sheet1.CommandButton1.Caption = "Start" Then
Sheet1.CommandButton1.Caption = "Stop"
Trigger = True
Call Log
Else
Sheet1.CommandButton1.Caption = "Start"
End If
End Sub
and then I modified your function as such:
Sub Log()
Static a As Integer
Static b As Integer
If Trigger Then
a = 2
b = 0
Trigger = False
End If
If a > 240 Then Exit Sub
b = b + 1
If b = 1001 Then
b = 1
a = a + 3
End If
Cells(b, a) = Time
Cells(b, a - 1) = Cells(1, 1)
If Sheet1.CommandButton1.Caption = "Stop" Then
Application.OnTime Time + TimeValue("00:00:01"), "Log"
End If
End Sub
you'll also need to add a global variable before your log subroutine:
Public Trigger as Boolean