VBA - how to conditionally skip a for loop iteration

后端 未结 6 1210
Happy的楠姐
Happy的楠姐 2020-11-30 01:23

I have a for loop over an array. What I want to do is test for a certain condition in the loop and skip to the next iteration if true:

For i = LBound(Schedul         


        
6条回答
  •  無奈伤痛
    2020-11-30 02:10

    Couldn't you just do something simple like this?

    For i = LBound(Schedule, 1) To UBound(Schedule, 1)
      If (Schedule(i, 1) < ReferenceDate) Then
         PrevCouponIndex = i
      Else
         DF = Application.Run("SomeFunction"....)
         PV = PV + (DF * Coupon / CouponFrequency)
      End If
    Next
    

提交回复
热议问题