JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,532
- Office Version
- 365
- Platform
- Windows
Finding that M$FT in its infinite wisdom chose not to provide a built-in IsDate function to go along with all of the other IsXxx functions, I decided to write my own. Here it is:
It works fine if I pass it a cell address or the scalar name of a cell, but not if I pass it a named range of the column the cell is in.
<tbody>
</tbody>
Column C is named "DateUseBy".
Cell C5 is named "temp".
If I put stop on the UDF, the parameter "cell" shows up as "empty" in the last three calls (D6-D8).
What do I have to do to get Excel to pass the cell contents to the UDF for these calls?
Code:
Function MyIsDate(ByVal cell As Variant) As Boolean
MyIsDate = IsDate(cell)
End Function
It works fine if I pass it a cell address or the scalar name of a cell, but not if I pass it a named range of the column the cell is in.
R/C | C | D | E |
4 | 11/12/19 | TRUE | D4: =myisdate(C4) |
5 | 11/12/19 | TRUE | D5: =myisdate(temp) |
6 | 11/12/19 | FALSE | D6: =myisdate(DateUseBy) |
7 | 11/12/19 | FALSE | D7: =myisdate(+DateUseBy) |
8 | 11/12/19 | FALSE | D8: =myisdate(0+DateUseBy) |
<tbody>
</tbody>
Column C is named "DateUseBy".
Cell C5 is named "temp".
If I put stop on the UDF, the parameter "cell" shows up as "empty" in the last three calls (D6-D8).
What do I have to do to get Excel to pass the cell contents to the UDF for these calls?