#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default 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

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
Time calculations for Scheduled Time vs. Actual Time Worked The Caterer Excel Discussion (Misc queries) 1 November 29th 09 08:08 AM
straight time, time and a half, and double time Jeremy Excel Discussion (Misc queries) 3 September 23rd 08 09:03 PM
Calculate Ending time using Start Time and Elapsed Time Chief 711 Excel Worksheet Functions 5 May 13th 08 04:34 PM
Formula to find Stop Time from Start Time and Total Minutes Jonathan Bickett Excel Worksheet Functions 5 March 7th 07 05:22 PM
Calculating days & time left from start date/time to end date/time marie Excel Worksheet Functions 7 December 7th 05 02:36 PM


All times are GMT +1. The time now is 03:58 PM.

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

About Us

"It's about Microsoft Excel"