Hi everyone!
I have a problem with a part of my program. I would like to execute the second expression in this statement:
If AndAlso(ActiveCell.Offset(i - 1, 2) <> "", DateValue(ActiveCell.Offset (i - 1, 2)) < DateValue(Today)) Then
ActiveCell.Offset(i - 1, -7).Value = "4"
ONLY if the first expression is not true. Since excel seems to execute both statements in an AND command, I wrote my own AndAlso function:
Public Function AndAlso(expr1 As Boolean, expr2 As Boolean) As Boolean
If expr1 Then
If expr2 Then
AndAlso = True
Else
AndAlso = False
End If
Else
AndAlso = False
End If
End Function
(Sorry for the bad indent!) It doesn't look so nice, so I am figuring that there must be better ways. Also I still get an error message from the DateValue-execution when the cell is empty. Anyone has any ideas?
Bookmarks