こんにちは、テキストボックスで文字列を見つけるのに問題があります。これまでのところ、コンマ文字のみを検出しています。今は午後 23 時、午後 24 時、午前 25 時を入力します。
Dim tdates() As String
Dim numberOfDates, xcount As Integer
tdates = Split(TXTDAYS.Text, ",")
numberOfDates = UBound(tdates)
Dim counter As Integer
' loop through each input
For counter = 0 To numberOfDates
Dim xdate As String
xdate = LCase$(tdates(counter))
If Len(xdate) <= 2 Then
xcount = xcount + 1
Else
' if the original text has am or pm in it, add .5
If InStr(1, xdate, "am") > 0 Or InStr(1, xdate, "pm") > 0 Then
xcount = xcount + 0.5 'problem here it doesn't count
End If
End If
Next
コンマと am pm 文字列をより適切に検出することにより、これを行うためのより良い方法がある場合。