Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check hour format
To fill out a form i'm asking the user to input time in 24 hour notation
in an inputbox. For example 13:30 or 21:45 or 08:30. Most users do that correctly but some are messing things up by inputting all kinds of invalid formats, something like: 08;30 (semicolon) 08.30 (dot) 08,30 (comma) 8 hour and 30 minutes (text) "My start time is 8 o'clock and thirty minutes" (text, complete sentence which is BS!) So i'm looking for a routine thats checks the input and format that input as hh:mm. When the users input is invalid - send him back to the inputbox for a new attempt. Keep sending him back till the input is valid (hh:mm). -- With Kind Regards, Bret Bernever April 20, 1986 Celtics (135) - Bulls (131) Larry Bird: "God disguised as Michael Jordan" |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check hour format
This is an outline of the VBA solution,
1. do a "split" with delimiter ':' on the input and use "ubound" to check that there are two fields. 2. check each field f with the operator f like "##" to verify it is a two digit number. 3. check that the first field numeric value is 0-23 and second is 0-59. HM "Bret Bernever" wrote in message ... To fill out a form i'm asking the user to input time in 24 hour notation in an inputbox. For example 13:30 or 21:45 or 08:30. Most users do that correctly but some are messing things up by inputting all kinds of invalid formats, something like: 08;30 (semicolon) 08.30 (dot) 08,30 (comma) 8 hour and 30 minutes (text) "My start time is 8 o'clock and thirty minutes" (text, complete sentence which is BS!) So i'm looking for a routine thats checks the input and format that input as hh:mm. When the users input is invalid - send him back to the inputbox for a new attempt. Keep sending him back till the input is valid (hh:mm). -- With Kind Regards, Bret Bernever April 20, 1986 Celtics (135) - Bulls (131) Larry Bird: "God disguised as Michael Jordan" |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check hour format
Have you thought about using a different technique to get the time--maybe a
couple of spinners or scrollbars? Bret Bernever wrote: To fill out a form i'm asking the user to input time in 24 hour notation in an inputbox. For example 13:30 or 21:45 or 08:30. Most users do that correctly but some are messing things up by inputting all kinds of invalid formats, something like: 08;30 (semicolon) 08.30 (dot) 08,30 (comma) 8 hour and 30 minutes (text) "My start time is 8 o'clock and thirty minutes" (text, complete sentence which is BS!) So i'm looking for a routine thats checks the input and format that input as hh:mm. When the users input is invalid - send him back to the inputbox for a new attempt. Keep sending him back till the input is valid (hh:mm). -- With Kind Regards, Bret Bernever April 20, 1986 Celtics (135) - Bulls (131) Larry Bird: "God disguised as Michael Jordan" -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check hour format
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding time in 24 hour format to produce hours in decimal format | Excel Worksheet Functions | |||
Converting from 12-hour to 24-hour format | Excel Worksheet Functions | |||
get HOUR check from NOW() cell | Excel Discussion (Misc queries) | |||
Hour format | New Users to Excel | |||
24 Hour Format For Timesheet | Excel Discussion (Misc queries) |