View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
onedaywhen onedaywhen is offline
external usenet poster
 
Posts: 459
Default A better way to create this function. To long for Data Validation.

Because you cross-posted to microsoft.public.excel.programming, here's
an approach that uses regular expressions:

Private Sub Test()
Dim m_oVbs As Object
Set m_oVbs = CreateObject("VBScript.RegExp")
With m_oVbs
.Pattern = "[0-9][0-9]:[0-5][0-9]:[0-5][0-9]"
MsgBox .Test("30:01:00")
End With
End Sub

--

"arno" wrote in message ...
Hi Niklas,

In a text cell I want to check if the user have entered a valid interval.

A valid intervall looks like this 33:01:00.

why don't you use a cell that is formatted as time, [hh]:mm:ss? then you
only have to validate data (menu Data) to be less than the "time" 100:00:00.

regards

arno