
Originally Posted by
DGagnon
i added rounding to the 4th digit here:
Sub LoopInOut()
i = 4
With Sheets("To Plot")
.Range("A" & i - 1).Value = .Range("E5").Value
Do Until .Range("A" & i - 1).Value >= .Range("F5").Value
.Range("A" & i).Value = Round(.Range("A" & i - 1).Value + .Range("G5").Value, 4)
i = i + 1
Loop
For i = 3 To .Range("A100000").End(xlUp).Row
Sheets("GUI").Range("C10").Value = .Cells(i, 1).Value
Application.Calculate
.Cells(i, 2).Value = Sheets("GUI").Range("C15").Value
.Cells(i, 3).Value = Sheets("GUI").Range("C14").Value
Next i
End With
End Sub
Thanks! It works now!
Just one more request, I tried to modify the code so it produces one row in each go, instead or generating column A first, then using the column A data to generate column B and C.
But the problem is the last row's column B and C are blank.
i.e.
A B C
1.61 (blank) (blank)
Maybe I've done something wrongly in the code?
Sub LoopInOut()
i = 4
With Sheets("To Plot")
.Range("A" & i - 1).Value = .Range("E5").Value
Do Until .Range("A" & i - 1).Value >= .Range("F5").Value
.Range("A" & i).Value = Round(.Range("A" & i - 1).Value + .Range("G5").Value, 4)
Sheets("GUI").Range("C10").Value = .Cells(i - 1, 1).Value
Application.Calculate
.Cells(i - 1, 2).Value = Sheets("GUI").Range("C15").Value
.Cells(i - 1, 3).Value = Sheets("GUI").Range("C14").Value
i = i + 1
Loop
End With
End Sub
Bookmarks