VBA Laufzeitfehler 13
02.10.2015 20:08:30
WalterK
ich komme wieder einmal nicht weiter:
Die Schreibweise meiner Schleife scheint nicht zu passen:
Option Explicit
Sub Zeiten_FK_Details()
Dim wks As Worksheet
Dim LzwksB As Long
Dim h As Long
Dim i As Long
Dim j As Long
Static CalculationMode As Long
Set wks = Worksheets("Zeiten")
LzwksB = wks.Cells(Rows.Count, 2).End(xlUp).Row
With Application
.ScreenUpdating = False
.EnableEvents = False
CalculationMode = .Calculation
.Calculation = xlManual
.DisplayAlerts = False
End With
For h = 1 To 1000
If wks.Cells(h, 5) = "01:00" Or wks.Cells(h, 5) = "02:00" Or wks.Cells(h, 5) = "00:00" _
Or wks.Cells(h, 5) = "00:59" Then
wks.Cells(h, 5).Interior.ColorIndex = 6
End If
Next h
For i = 1 To 1000 'diese Schleife funktioniert nicht. Fehlermeldung: Laufzeitfehler 13, _
Typen unverträglich
If wks.Cells(i, 5) * 1 = "00:00" * 1 And wks.Cells(i, 6) * 1 >= "00:00" * 1 Then
wks.Rows(i + 1).Insert Shift:=xlDown
End If
Next i
For j = 1 To 1000 'diese Schleife funktioniert nicht. Fehlermeldung: Laufzeitfehler 13, _
Typen unverträglich
If wks.Cells(j, 5) * 1 = "00:00" * 1 Then
wks.Rows(j + 1).Insert Shift:=xlDown
End If
Next j
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = CalculationMode
.DisplayAlerts = True
.StatusBar = False
End With
End Sub
Hier die Datei mit den importierten Daten.https://www.herber.de/bbs/user/100560.xlsm
Danke für die Hilfe, Servus Walter