+ Reply to Thread
Results 1 to 5 of 5

Check if textbox entry is in hh:MM format

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    464

    Check if textbox entry is in hh:MM format

    Hi all,

    could someone tell me the best way to validate that the text in a textbox is in hh:MM format please using VBA..

    I.e the following will not be accepted:

    'john'
    '123'
    '12:123'
    '25:25'

    but this will be accepted..

    '14:55'

    Thanks
    John

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Check if textbox entry is in hh:MM format

    I woud use two comboboxes to select hours & minutes. Then combine the two in the correct format when needed.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Check if textbox entry is in hh:MM format

    Here's a quick example
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    464

    Re: Check if textbox entry is in hh:MM format

    Brilliant, thanks Roy. Much appreciated.

    John

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Check if textbox entry is in hh:MM format

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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