Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding time in 24 hour format to produce hours in decimal format Hercdriver Excel Worksheet Functions 11 December 29th 09 02:06 AM
Converting from 12-hour to 24-hour format Nathan Excel Worksheet Functions 2 July 15th 08 03:51 PM
get HOUR check from NOW() cell Nastech Excel Discussion (Misc queries) 5 May 27th 08 09:21 AM
Hour format tafexpert New Users to Excel 2 March 13th 08 07:19 AM
24 Hour Format For Timesheet faisca_aem Excel Discussion (Misc queries) 3 June 30th 06 03:05 AM


All times are GMT +1. The time now is 08:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"