+ Reply to Thread
Results 1 to 4 of 4

time:is it possible to check the format of a time value

  1. #1
    phil
    Guest

    time:is it possible to check the format of a time value

    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

  2. #2
    Chip Pearson
    Guest

    re: time:is it possible to check the format of a time value

    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




  3. #3
    Jim Thomlinson
    Guest

    re: time:is it possible to check the format of a time value

    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


  4. #4
    Jim Thomlinson
    Guest

    re: time:is it possible to check the format of a time value

    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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1