ungermkm
01-04-2015, 03:55 PM
I'm trying to compare dates in VBA and then use days360 between them, but I can't get it to work. Any thoughts?
Dim percentDateA As Date
Dim percentDateB As Date
Dim percentDateC As Date
Dim percentDateD As Date
Dim elapsedTime As Double
Dim days360temp As Double
elapsedTime = 0
For x = 3 To 82
For w = 64 To 68
For y = 28 To 61 Step 2
percentDateA = Cells(x, y)
percentDateB = Cells(x, y + 2)
percentDateC = Cells(1, w)
percentDateD = Cells(2, w)
If Cells(x, y) < Cells(1, w) And Cells(x, y + 2) < Cells(2, w) And Cells(x, y + 2) > Cells(1, w) Then
days360temp = Application.WorksheetFunction.Days360(percentDateC, percentDateB)
elapsedTime = elapsedTime + ((days360temp / 360) * (Cells(x, y + 1) / 100))
ElseIf ...
Dim percentDateA As Date
Dim percentDateB As Date
Dim percentDateC As Date
Dim percentDateD As Date
Dim elapsedTime As Double
Dim days360temp As Double
elapsedTime = 0
For x = 3 To 82
For w = 64 To 68
For y = 28 To 61 Step 2
percentDateA = Cells(x, y)
percentDateB = Cells(x, y + 2)
percentDateC = Cells(1, w)
percentDateD = Cells(2, w)
If Cells(x, y) < Cells(1, w) And Cells(x, y + 2) < Cells(2, w) And Cells(x, y + 2) > Cells(1, w) Then
days360temp = Application.WorksheetFunction.Days360(percentDateC, percentDateB)
elapsedTime = elapsedTime + ((days360temp / 360) * (Cells(x, y + 1) / 100))
ElseIf ...