Looping through Values

Yao567

New member
Joined
Oct 18, 2013
Messages
1
Reaction score
0
Points
0
Hi so basically i need to loop through the values xo=-7 and xf = 5
For a graph there need to be 21 grid pts ie 21 values between -7 and 5 and i calculate dx to be .6ish

Basically I just need help putting this into a loop using variables for the numbers so i can change the xo's and xf's etc

Code:
xo = InputBox("What is xo")
xf = InputBox("What is xf")
GridPts = InputBox("What is the number of GridPts")



Range("A1") = "xo"
ActiveCell.Offset(0, 1) = "xf"
ActiveCell.Offset(0, 2) = "GridPts"
ActiveCell.Offset(0, 3) = "dx"
ActiveCell.Offset(1, 0) = xo
ActiveCell.Offset(1, 1) = xf
ActiveCell.Offset(1, 2) = GridPts
ActiveCell.Offset(1, 3) = Dx(xo, xf, GridPts)
A = Dx(xo, xf, GridPts)

Range("B6") = "xo"
For i = xo To xf
Cells(i + 5, 1) = i
Next i
End Sub

Unfortunately the last part doesnt work as it should going from lets say -7 to 5 by .6 increments for a total of 21 values. :sad:
 
Back
Top