is it possible to check the format of a time value (like hh:mm) without
having to use regular expressions. the numberformat function doest seem to be
applicable to time
is it possible to check the format of a time value (like hh:mm) without
having to use regular expressions. the numberformat function doest seem to be
applicable to time
Try some code like the following:
Dim S1 As String
Dim T As Date
S1 = "12:34"
On Error Resume Next
T = TimeValue(S1)
If Err.Number = 0 Then
Debug.Print "valid time"
Else
Debug.Print "Not a valid time"
End If
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"phil" <[email protected]> wrote in message
news:[email protected]...
> is it possible to check the format of a time value (like hh:mm)
> without
> having to use regular expressions. the numberformat function
> doest seem to be
> applicable to time
I am not 100% sure what you mean? If I run this code with Cell A1 foramtted
"hh:mm", it seems to work...
--
HTH...
Jim Thomlinson
"phil" wrote:
> is it possible to check the format of a time value (like hh:mm) without
> having to use regular expressions. the numberformat function doest seem to be
> applicable to time
I meant this code... The intricacies of Cut and Paste is lost on me today...
MsgBox Range("A1").NumberFormat
--
HTH...
Jim Thomlinson
"Jim Thomlinson" wrote:
> I am not 100% sure what you mean? If I run this code with Cell A1 foramtted
> "hh:mm", it seems to work...
> --
> HTH...
>
> Jim Thomlinson
>
>
> "phil" wrote:
>
> > is it possible to check the format of a time value (like hh:mm) without
> > having to use regular expressions. the numberformat function doest seem to be
> > applicable to time
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks