Also, if you use the [#] button on the toolbar, you can paste code between the [ CODE ] and [ /CODE ] markers
Makes it easier to read
Sub time()
Dim myworksheet As Worksheet
Dim t As Long
Dim j As Long
Dim newtime As Long
Dim result As Long
j = 10
t = 0
Do While t <= 24
Cells(j, 23).Value = t
If Cells(j, 27).Value < 0.5 Or Cells(j, 27).Value > 5 Then
Cells(j, 24).GoalSeek Goal:=1E-16, ChangingCell:=Cells(j, 23)
End If
j = j + 1
result = Application.WorksheetFunction.RoundUp(Cells(j - 1, 23), 0)
newtime = Cells(j, 23).Value
If result > newtime Then
t = result
ElseIf result <= newtime Then
t = t + 1
End If
Loop
End Sub
Paul