Hello peeps,
Bear with me; I have no formal education to VBA and I am starting to pick up stuffs. My current project requires me to calculate a list of number of days between a list of dates and a fixed date. And I need to apply a fixed formula, which is exponential, into each of these derived values. For example:
Sub TryingOut()
Dim srtdate As Date, today As Date, years As Integer
'Calculate the number of years between dividend payout date and today
srtdate = Range("E7")
today = Sheets("Outlook").Range("C8")
years = DateDiff("yyyy", today, srtdate)
'The formula I would like to multiply against a list of values
Dim x As Long
x = Exp(-years)
End Sub
My list of dates occupies cell E7 to the very bottom. today is the fixed date. For each DateDiff, I would like to derive many x and multiply the x with the values in column F - my values also start from F7 all the way to the bottom.
How can I accomplish that? I googled around and noticed some users use Evaluate("F1:F" & "today"), something like that. Should I use loop?
Bear with me; I have no formal education to VBA and I am starting to pick up stuffs. My current project requires me to calculate a list of number of days between a list of dates and a fixed date. And I need to apply a fixed formula, which is exponential, into each of these derived values. For example:
Sub TryingOut()
Dim srtdate As Date, today As Date, years As Integer
'Calculate the number of years between dividend payout date and today
srtdate = Range("E7")
today = Sheets("Outlook").Range("C8")
years = DateDiff("yyyy", today, srtdate)
'The formula I would like to multiply against a list of values
Dim x As Long
x = Exp(-years)
End Sub
My list of dates occupies cell E7 to the very bottom. today is the fixed date. For each DateDiff, I would like to derive many x and multiply the x with the values in column F - my values also start from F7 all the way to the bottom.
How can I accomplish that? I googled around and noticed some users use Evaluate("F1:F" & "today"), something like that. Should I use loop?