Aşağıda yazdığım kod yazıyor, ancak bu satırı ve yalnızca bu satırı eklediğim çizgi ile ilgili bir sorun almaya devam ediyorum. Diğer tüm satırları yorumladım ve bunu problem çizgisi olarak izole ettim, ama hayatım boyunca ve yaptığım bir saat veya daha fazla araştırma ile sorunun ne olduğunu anlayamıyorum. Muhtemelen gerçekten bariz olanı, ama gerçekten sıkışıp kaldım ve beni delirtiyor. Neyse Başka bir işlev içinde VBA İşlevi çağrılıyor Sorun
, kod vardiya süreleri ve dil yeteneği içeren bir veri Range alıp (aşağıdaki kodda The_Time) Belirli bir zaman süresi içinde belirli bir dile sahip birçok insan mevcuttur göstermek için kullanılacakHerhangi bir yardım büyük memnuniyetle karşılanacaktır!
stCell = c.Value
If InStr(stCell, "Eng") > 0 Then
Ya c.Value atama başarısız olur:
Function ReturnAvailability(The_Time As String, The_Info As Range)
Dim The_Lang As String
Dim The_Shift_Start As String
Dim The_Shift_End As String
Dim stGotIt As String
Dim stCell As Integer
Dim Counter As Integer
Counter = 0
For Each r In The_Info.Rows
For Each c In r.Cells
stCell = c.Value
If InStr(stCell, "Eng") > 0 Then
The_Lang = "Eng"
ElseIf InStr(c, ":") > 0 Then
stGotIt = StrReverse(c)
stGotIt = Left(c, InStr(1, c, " ", vbTextCompare))
The_Shift_End = StrReverse(Trim(stGotIt))
stGotIt = Left(The_Shift, InStr(1, The_Shift, " ", vbTextCompare))
The_Shift_Start = stGotIt
stCell = ReturnAvailabilityEnglish(The_Time, The_Shift_Start, The_Shift_End) ' this is the line causing the error
End If
Next c
Next r
ReturnAvailability = Counter
End Function
Function ReturnAvailabilityEnglish(The_Time As String, The_Shift_Start As String, The_Shift_End As String)
Dim Time_Hour As Integer
Dim Time_Min As Integer
Dim Start_Hour As Integer
Dim Start_Min As Integer
Dim End_Hour As Integer
Dim End_Min As Integer
Dim Available As Integer
Available = 13
Time_Hour = CInt(Left(The_Time, 2))
Time_Min = CInt(Right(The_Time, 2))
Start_Hour = CInt(Left(The_Shift_Start, 2))
Start_Min = CInt(Right(The_Shift_Start, 2))
End_Hour = CInt(Left(The_Shift_End, 2))
End_Min = CInt(Right(The_Shift_End, 2))
If Start_Hour <= Time_Hour And Start_Min <= Time_Min Then
If End_Hour > Time_Hour And End_Min > Time_Min Then
Available = 1
Else
Available = 0
End If
End If
ReturnAvailabilityEnglish = Available
End Function
sayesinde Darragh J
Hata hangi hatta neden oluyor? Derleme hatası mı, çalışma zamanı hatası mı? –
Üzgünüz, bu konuda yorum ekledi –
Hata nedir? – BenV