Hi,
Having trouble getting the following code to run. Any thoughts ?
I'd like to call the function only if a dates exist within any one row of the ranges within columns D or E? Is this possible ?
-------------------------------------------------
Sub TimeReg()
Dim StartDate As Range
Dim EndDate As Range
Dim Answer As Range
If StartDate > EndDate Then
Err.Raise 5
Exit Function
End If
Set StartDate = ActiveSheet.Range("D16:D100")
Set EndDate = ActiveSheet.Range("E16:E100")
Set Answer = ActiveSheet.Range("F16:F100")
Answer = DateDiff("d", StartDate, EndDate)
End Sub
Having trouble getting the following code to run. Any thoughts ?
I'd like to call the function only if a dates exist within any one row of the ranges within columns D or E? Is this possible ?
-------------------------------------------------
Sub TimeReg()
Dim StartDate As Range
Dim EndDate As Range
Dim Answer As Range
If StartDate > EndDate Then
Err.Raise 5
Exit Function
End If
Set StartDate = ActiveSheet.Range("D16:D100")
Set EndDate = ActiveSheet.Range("E16:E100")
Set Answer = ActiveSheet.Range("F16:F100")
Answer = DateDiff("d", StartDate, EndDate)
End Sub