0

I am able to print out the values of each loop iteration when the step size is 1. Is there a way I can do the same with smaller step sizes? The code below is what I have been using when the step size is 1

For i = 1 To Height - 1
    Moment = ((Load * i) / (3 * (Height ^ 2)) * ((Height ^ 2) - (i ^ 2)))
    Application.Calculate
    Sheet2.Range("A" & i).Value = i
    Sheet2.Range("B" & i).Value = Moment
Next i
Community
  • 1
  • 1
Derek
  • 15
  • 3
  • When using fractional steps, you might want to consider http://stackoverflow.com/q/29558276/11683 – GSerg Nov 10 '16 at 21:13

1 Answers1

1

I suppose this could be flagged as "easily google-able" but you can modify the the for loop with step [increment]:

 dim k as int    
 k = 1
 For i = 1 To Height - 1 step 0.1
     Moment = ((Load * i) / (3 * (Height ^ 2)) * ((Height ^ 2) - (i ^ 2)))
     Application.Calculate
     Sheet2.Range("A" & k).Value = i
     Sheet2.Range("B" & k).Value = Moment
     k = k + 1
Next i
YowE3K
  • 23,852
  • 7
  • 26
  • 40
bbadgett
  • 70
  • 1
  • 7