danners430
New Member
- Joined
- Aug 3, 2017
- Messages
- 45
Hey folks,
I've been having a rather "interesting" issue lately writing a UDF for conditional formatting. It's designed to highlight overdue tasks, according to the duration assigned to each task (Dur1-3). It returns TRUE when the task is overdue, and FALSE otherwise.
In the conditional formatting I simply had the formula =Deadline(ROW($G1))
In order to capture the error, I added an error handler that displayed the error code, and details about the variable Row. The error was a type mismatch, and the variable details returned False to isNumeric, isDate, isEmpty, isNull etc. and varType = 8204...
Anyone know what sort of number format =ROW returns? it seems to not be a straightforward number...
I've been having a rather "interesting" issue lately writing a UDF for conditional formatting. It's designed to highlight overdue tasks, according to the duration assigned to each task (Dur1-3). It returns TRUE when the task is overdue, and FALSE otherwise.
Code:
Public Function Deadline(Row As Variant) As Boolean
With Sheet1
If DeadlineCanc = True Then Exit Function
Select Case .Cells(Row, "D")
Case Dur1:
If DateDiff("Y", .Cells(Row, "G"), Now) > 7 Then Deadline = True Else Deadline = False
Case Dur2:
If DateDiff("Y", .Cells(Row, "G"), Now) > 31 Then Deadline = True Else Deadline = False
Case Dur3:
If DateDiff("Y", .Cells(Row, "G"), Now) > 90 Then Deadline = True Else Deadline = False
End Select
End With
End Function
In the conditional formatting I simply had the formula =Deadline(ROW($G1))
In order to capture the error, I added an error handler that displayed the error code, and details about the variable Row. The error was a type mismatch, and the variable details returned False to isNumeric, isDate, isEmpty, isNull etc. and varType = 8204...
Anyone know what sort of number format =ROW returns? it seems to not be a straightforward number...