Run-time Error bei Do While - Loop
29.08.2007 06:10:00
Ralf
Ich bin gerade dabei die Mitarbeiterzu- und Abgänge darzustellen. Für alle 12 Monate stehen in den Spalten T bis AE eine 0 bzw. eine 1, je nach dem, ob der MA in diesem Monat schon/noch der Firma zugehörig war.
Mein Code (VBA) lautet wie folgt:
For m = frow To lrow Step 1 'Erste Zeile bis letzte Zeile
With Workbooks("Head Count NEW.xls").Worksheets("Headcount current (2)")
If Application.WorksheetFunction.Sum(Range(Cells(m, fcol), Cells(m, lcol))) = 12 Then
.Cells(m, (lcol + 1)) = "normal" 'MA ist das ganze Jahr anwesend
Else
If .Cells(m, fcol) = 1 Then 'MA geht im Laufe des Jahres ab
**** Do While .cell(m, n) = 1
.Cells(m, (lcol + 1)) = "abgang"
n = n + 1
Loop
Else
If .Cells(m, fcol) = 0 Then 'MA kommt im Laufe des Jahres hinzu
Do While .Cells(m, n) = 0
.Cells(m, (lcol + 1)) = "zugang"
n = n + 1
Loop
End If
End If
End If
End With
Next m
Bei der mit * markierten Do While Schleife erscheint allerdings die Fehlermeldung "Run-time Error '438': Object doesn't support this property or method'. Woran kann das liegen?
Vielen Dank für euere Hilfe,
Ralf
Anzeige