Someone told me I can't have a loop within a VBA function that offsets to different cells from current cells, such as
If anyone has any insight, would appreciate some help! Thanks!
Code:
Function test(startdate As Variant, enddate As Variant) As Variant
..................... 'removed code
If currmo > ActiveCell And Not IsDate(ActiveCell) Then
pricejump = Value.Range("frontmth_last").End(xlDown) + price
price = pricejump
ElseIf currmo < ActiveCell Then
pricejump = ActiveCell.Offset(0, 1) + price
price = pricejump
If currmo < WorksheetFunction.EDate(currmo, 1) Then
currmojump = currmo
Else:
currmojump = WorksheetFunction.EDate(currmo, 1)
End If
currmo = currmojump
Else:
Range("front_fstnot").Offset(i, 0).Active
currmo = ActiveCell
If anyone has any insight, would appreciate some help! Thanks!