I ended up with a sub driven by a command button and the function as follows
We can't use the worksheet.change event because it is fired every time the sub
changes one of the fields so it gets in a loop.
The function is in a module and the sub is in the worksheet code (although for
practical purposes I will be moving it to a module).
Private Sub RecalcSeq()
Dim i As Integer
Dim Number_Of_Rows As Integer
Dim Seq_Number As Integer
' Determine number of rows containing data
Number_Of_Rows = UsedRange.Rows.Count
Seq_Number = 1
For i = 1 To Number_Of_Rows
If Left(Range("D" & i).Formula, 5) = "=seq(" Then
Range("D" & i).Formula = "=seq(" & Seq_Number & ")"
Seq_Number = Seq_Number + 1
End If
Next i
End Sub
Function seq(intSeqNo As Integer) As Integer
seq = intSeqNo
End Function